简体   繁体   English

从数据库中选择最多的国家

[英]Select the largest number of countries from database

I have a database likes this: - ID --- COUNTRY 我有一个像这样的数据库:-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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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