SELECT S.name, H.pop
FROM HOME H
INNER JOIN STATE S
ON S.name = H.pop
WHERE H.pop >= 10000 ;
我想让这个名字变得独一无二,我尝试了一些不同的东西。但我正在努力寻找解决方案。
谁能帮我?
SELECT DISTINCT S.name, S.name AS pop --SINCE BOTH ARE SAME
FROM HOME H
INNER JOIN STATE S
ON S.name = H.pop
WHERE H.pop >= 10000 ;
是的,我认为 J W 的评论很好。你可以试试:
SELECT S.name, sum(H.pop)
FROM HOME H
INNER JOIN STATE S
ON S.name = H.pop
WHERE H.pop >= 10000
GROUP BY S.name;
或者
SELECT distinct S.name, H.pop
FROM HOME H
INNER JOIN STATE S
ON S.name = H.pop
WHERE H.pop >= 10000;