简体   繁体   中英

Select the largest number of countries from database

I have a database likes this: - ID --- 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM