Mysql: 在世界数据库中,如果要查看每个大陆最大的城市(按人口选择),代码如何?

Mysql: In the world database how is the code if you want to see the largest city (chosen by population) in each continent?

还必须显示其国家和人口。

这个 hack 显示了国家和请求。 ('World' 是一个 mysql 示例数据库)。

select a.continent, co.name, c.name, c.population from city c, country co,
(select co.continent, max(ci.population) as m
from country co, city ci 
where co.code=ci.countrycode 
group by co.continent) a
where c.population=a.m and c.countrycode=co.code

结果: