我想把没有经理的分行还回去。
我就是这么想的:

SELECT branchno, city FROM branch
WHERE branchno IN
(SELECT branchno FROM STAFF
WHERE position <> 'Manager');

它返回:
 branchno |   city
----------+----------
 B005     | London
 B007     | Aberdeen
 B003     | Glasgow
 (3 rows)

最佳答案

使用not in

select *
from branch
where branchno not in (
  select branchno from staff
  where position = 'Manager'
);

关于sql - 我该如何退还没有经理的分支机构? (SQL),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41554784/

10-09 02:59