SELECT DISTINCT director.lastname, director.firstname
FROM director LEFT JOIN movdir ON director.dirnum = movdir.dirnum
这就是我现在所拥有的,但我必须查看一个movdir
表,看看dirnum(director number)
是否只显示一次。如果是这样,我必须转到director
表,查看dirnum
,看看他们的名字是什么,看看该名称附加了该名称。
答案 0 :(得分:2)
您可以将GROUP BY
与HAVING
- 子句:
SELECT director.lastname, director.firstname
FROM director
INNER JOIN movdir ON director.dirnum = movdir.dirnum
GROUP BY director.lastname, director.firstname
HAVING COUNT(*) = 1