How to list the top 10 most duplicate rows?
I want to fetch the top 10 most duplicate rows开发者_高级运维 from the following table:
Table Name: votes(id,vote)
--------------------------
1 | Taylor Swift
2 | Maroon5
3 | Maroon5
4 | Maroon5
5 | Taylor Swift
6 | Kanye West
Output Should be something like:
1. Maroon5: 3 votes
2. Taylor Swift: 2 votes
3. Kanye West: 1 votes
How to do that using MySQL only ( if possible )
Thank you
select vote, count(*)
from votes
group by 1
order by 2 desc
limit 10
select vote,count(vote) from votes group by vote order by count(vote) desc limit 10
精彩评论