答案 0 :(得分:0)
您的查询没有任何意义。但是,如果您将City
和Country
表连接在一起,并按地区分组,那么您可以为每个地区计算以下统计信息:
SELECT t1.Region,
COUNT(*) AS cityCount,
COUNT(DISTINCT t1.code) AS countryCount,
SUM(t2.Population) AS regionPop
FROM Country t1
LEFT JOIN City t2
ON t1.Code = t2.CountryCode
GROUP BY t1.Region