How do I select the longest 'string' from a table when grouping

后端 未结 5 2060
北海茫月
北海茫月 2020-12-23 15:45

Example:

SELECT partnumber, manufacturer, condition, SUM(qty), AVG(price), description FROM parts

WHERE [something]

GROUP BY partnumber, manufacturer, cond         


        
5条回答
  •  情歌与酒
    2020-12-23 16:29

    Try ORDER BY LENGTH(description) DESC and use LIMIT 1 to only get the largest.

提交回复
热议问题