日期:2014-05-16  浏览次数:20502 次

not exists不能仅仅理解为差集

要看以谁为主表,

见如下示例,同样的表,主表不一样,结果不一样:

?

?

select * from [left]  l
where not exists (
select * from [right] r
where l.name=r.name
)

-----------------------------
--下面这个例子充分说明,not exists不能单单理解为差集
select * from [right]  r
where not exists (
select * from [left] l
where l.name=r.name
)
?

?

?

?

?

?

?