Select the first 50 words of an article
I’m cleaning up my code snippets and i found the following little trick in one of them that i’ve removed. Assuming that different words are separated by spaces we can use SUBSTRING_INDEX as following:
SELECT SUBSTRING_INDEX(body,' ',50) AS dn FROM mytable