查詢是:顯示國家代碼和具有大於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