Reputation: 2379
I'm running this query, I need to find out the longest string in a given field, so I can make sure it doesn't wrap when displayed on the front-end.
#The query is:
SELECT MAX(CHAR_LENGTH(fullname)), fullname FROM soft_data;
What I expected was something like: 58 "string of 58 character length"
What I got was:41 "string of 27 character length"
max(char_length(fullname)), fullname
41 Zoom Player Professional 7
I hope I've explained well enough.
Thanks.
Upvotes: 0
Views: 55
Reputation: 115520
SELECT CHAR_LENGTH(fullname)
, fullname
FROM soft_data
ORDER BY CHAR_LENGTH(fullname) DESC
LIMIT 1
Upvotes: 2