{"id":511,"date":"2011-11-28T01:43:51","date_gmt":"2011-11-28T06:43:51","guid":{"rendered":"http:\/\/blog.xfloyd.net\/?p=511"},"modified":"2011-11-28T01:45:15","modified_gmt":"2011-11-28T06:45:15","slug":"511","status":"publish","type":"post","link":"https:\/\/xfloyd.net\/blog\/?p=511","title":{"rendered":"Find longest string in a column MySQL"},"content":{"rendered":"<pre>select name from daTable\r\nwhere length(name) =\r\n( select max(length(name)) from daTable )<\/pre>\n<p>How about the record that has the most number of words ? I am referring to MYSQL manual now, but still can&#8217;t find a solution for this.<\/p>\n<pre>SELECT lemma FROM word \r\nWHERE (LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) = \r\n(SELECT MAX(LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) FROM word);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;t find a solution for this. SELECT lemma FROM word WHERE (LENGTH(lemma)-LENGTH(REPLACE(lemma,&#8217; &#8216;,&#8221;))) = (SELECT MAX(LENGTH(lemma)-LENGTH(REPLACE(lemma,&#8217; &#8216;,&#8221;))) FROM word);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511"}],"collection":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=511"}],"version-history":[{"count":2,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":513,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions\/513"}],"wp:attachment":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}