查询是:显示国家代码和具有大于2种的官方语言SQL加入/嵌套查询
名我的回答是:
select
c.country_name,
cl.countrycode
from
country c,
countrylanguage cl
where
c.code=cl.countrycode and c.code IN
(select code
from countrylanguage
where cl.isOfficial='T'
group by cl.countrycode
having count(cl.isOfficial)>2
);
的问题是,如果任何一个国家有3个官方语言,多数民众赞成大于2,即多次相同的输出的显示如同 ZWE津巴布韦 ZWE津巴布韦 ZWE津巴布韦
但只有一个 我需要有两个表克伊芬如下
CountryLanguage (CountryCode, Language ,IsOfficial ,Percentage)
Country (Code ,country_Name)
该表具有了更多的属性,但我们不要求他们马上回答这个查询。
您的公司从事什么类型的数据库? MySql,Oracle,SQL Server? – Ageonix