给定表menu
,在他中是列 continent
,例如在他中是这个数据
continent
----------
africa
africa
europe
europe
europe
我想获得大陆名称,在列中出现更多次,即结果必须是europe
.
我写查询,但我认为我的查询很困难,对于这种情况必须存在更简单的解决方案。有一些想法吗?
这是我的查询
SELECT continent FROM (
SELECT continent, COUNT(continent) AS cnt FROM menu GROUP BY continent
) AS t
WHERE cnt = (
SELECT MAX(cnt) FROM (
SELECT COUNT(continent) AS cnt FROM menu GROUP BY continent
) AS t2
)