我正在做这个教程 - http://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial - 问题6是找到每个大洲最大的国家(按地区),显示大陆,名称和区域:我有答案是正确的,但如何在内部SELECT
中不使用SELECT的情况下得到相同的答案答案 0 :(得分:1)
如果不在内部选择中使用选择,则无法获得每个大洲中最大的国家/地区(按地区)。如果您只需要获得Continent和MAX区域,但由于您还需要国家/地区名称,那么您就不能这样做。
但是,如果这是另一种解决方案。
SELECT continent, name, area
FROM world
where (continent, area) in (select continent, max(area) from world group by continent)
答案 1 :(得分:0)
select name
from your_table
where isnull(gdp,0) > (
select max(isnull(gdp,0))
from your_table
where continent='europe')