为什么这三个查询如此不同?根据 MySQL 文档,他们不应该都做同样的事情吗?
select cc, max(c) as "Most Official Billingual Count" from (
select CountryCode as cc, count(*) as c from countrylanguage where isofficial = "T"
group by cc
) t group by cc
以这种格式返回多行:CountryCode Official_Language_Count_Blabla
而如果我删除一组...
select cc, max(c) as "Most Official Billingual Count" from (
select CountryCode as cc, count(*) as c from countrylanguage where isofficial = "T"
) t group by cc
它返回第一个国家代码以及总数:ABW 238
还有这个:
select cc, max(c) as "Most Official Billingual Count" from (
select CountryCode as cc, count(*) as c from countrylanguage where isofficial = "T"
group by cc
) t
将返回如下内容: ABW 4
我对这整个群体感到非常困惑。
内部查询
select CountryCode as cc, count(*) as c from countrylanguage where isofficial = "T
应该返回所有国家代码并计算重复的国家代码吗?对?但它不会那样做。似乎我必须排第一个队列才能获得所需的效果,这对我来说非常混乱