Question

Hi
i have a columm in the table and i want to select the most common item from the selected column. The table is set up publication:

  • id
  • Title
  • published

I want to beable to select the most recurring places where publications have been published. Is this possible to do?
Thanks in Advance
Dean

Was it helpful?

Solution

select published, count(*) nbr
from table1
group by published
order by nbr desc
limit 1

You don't really need the count, but if you wanted confirmation that the choice seemed reasonable, you could use it. Also, you didn't specifically say whether you wanted ONLY the one, or wanted to see which was the most frequent, along with frequencies of the other records. Take off the limit 1 if you want to see all records.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top