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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -