The Blog

Find longest string in a column MySQL Posted on

select name from daTable
where length(name) =
( select max(length(name)) from daTable )

How about the record that has the most number of words ? I am referring to MYSQL manual now, but still can’t find a solution for this.

SELECT lemma FROM word 
WHERE (LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) = 
(SELECT MAX(LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) FROM word);
This entry was posted in MySQL. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code