当前位置:Gxlcms > 数据库问题 > MySQL嵌套查询语句

MySQL嵌套查询语句

时间:2021-07-01 10:21:17 帮助过:12人阅读

MySQL嵌套查询语句统计每个省的人口最多的与最少的城市

SELECT District,NAME,Population FROM city WHERE Population IN (SELECT MIN(Population) FROM city 
WHERE city.CountryCode=‘CHN‘
GROUP BY city.District)
UNION
SELECT District,NAME,Population FROM city WHERE Population IN (SELECT MAX(Population) FROM city 
WHERE city.CountryCode=‘CHN‘
GROUP BY city.District)

MySQL嵌套查询语句

标签:mysq   嵌套   min   sel   ati   ict   查询语句   查询   mysql   

人气教程排行