table 中的值不在另一个值中
Values from a table that are not in another one
我有两个表,A 和 B。
A
ID age
1 24
2 25
45 22
B
ID school
34 school1
1 school2
我想要 select B 中但不在 A 中的 ID。
我写了
Select distinct bb.school
From B as bb
Left outer join A as aa
On bb.ID=aa.ID
inner join C as cc
On bb.school=cc.school
此代码 returns 与使用内部联接而不是左外部联接时的行数完全相同。
我做错了什么吗?
尝试使用 not in
;
Select * From A Where ID Not In ( Select ID From B )
我有两个表,A 和 B。
A
ID age
1 24
2 25
45 22
B
ID school
34 school1
1 school2
我想要 select B 中但不在 A 中的 ID。 我写了
Select distinct bb.school
From B as bb
Left outer join A as aa
On bb.ID=aa.ID
inner join C as cc
On bb.school=cc.school
此代码 returns 与使用内部联接而不是左外部联接时的行数完全相同。 我做错了什么吗?
尝试使用 not in
;
Select * From A Where ID Not In ( Select ID From B )