mysql - How do I select the longest 'string' from a table when grouping -
example:
select partnumber, manufacturer, condition, sum(qty), avg(price), description parts [something] group partnumber, manufacturer, condition i have descriptions blank, , there can many partnumber, manufacturer, condition values, , on group seems take first description available, can blank. id longest description available.
i tried this:
max(length(description)) however returns number of characters in string. possible im trying in mysql?
try order length(description) desc , use limit 1 largest.
Comments
Post a Comment