Select the largest number of countries from database
I have a database likes this: - I开发者_如何学运维D --- COUNTRY
This database is filled with data, and there are lots of double entries, but they should be there. What I am trying to do, is select the country with most entries in the database, but still don't know how to put a query together.
SELECT `COUNTRY`, count(`COUNTRY`) FROM `table` GROUP BY `COUNTRY`;
select `country`, count(`country`) as 'count' from `table` group by `country` order by `count` DESC LIMIT, 0,1
SELECT id, country, COUNT(*) as total FROM table GROUP BY country ORDER BY total DESC LIMIT 1
精彩评论