View Single Post

  #2 (permalink)  
Old 03-13-2007
Paul Lautman
 
Posts: n/a
Default Re: selecting the single most common value from a certain column?

Ciaran wrote:
> Hi is there a way of selecting the single most common value from a
> certain column in a mysql table?
>
> Thanks a lot,
> Ciarán


SELECT column_name, count(*) as quantity
FROM table_name
GROUP BY column_name
ORDER BY quantity DESC
LIMIT 1


Reply With Quote