Select top distinct results ordered by frequency

I haven’t tested it, so the syntax might not be perfect, but what about something like this :

select name, count(*) as frequency
from your_table
group by name
order by count(*) desc

Should give you unique names and the corresponding number of times each name appears in the table, ordered by that number.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)