我有一个MYSQL数据集,如下所示:
表格
City
Country
CountryLanguage
...
以下查询获取欧洲每个地区的结果
2a:select DISTINCT Region from Country where Continent="Europe"
我现在需要查询的是:
对于每个地区,显示该地区的国家/地区数量
我尝试了一些事情,其中没有一个有效 - 我不知道,是否有人可以给我任何指示?
(表架构)
ID | Name | Continent | Region
1 | Aruba | North America | Carribean
答案 0 :(得分:0)
您可以使用此查询 -
select continent, region, count(*) as "No of Country" from Country where continent like 'Europe' group by region;
如果您想要变更
,此查询可以为您提供更多帮助select continent, region, group_concat(Name) as "List of Country" ,count(*) as "No of Country" from Country where continent like 'Europe' group by region;