0
SELECT S.name, H.pop
FROM HOME H
INNER JOIN STATE S
ON S.name = H.pop
WHERE H.pop >= 10000 ;

我想让这个名字变得独一无二,我尝试了一些不同的东西。但我正在努力寻找解决方案。

谁能帮我?

4

2 回答 2

1
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 ;
于 2013-04-03T06:21:38.877 回答
0

是的,我认为 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;
于 2013-04-03T05:29:32.733 回答