select a.* from a,b where a.khh =b.khh (+) and b.khh is null
b.khh(+)是右连接吧,为啥不是a.khh(+)=b.khh and b.khh is null 啊
改用 not existsselect * from a where not exists(select 1 from b where a.id=b.id)
select a.* from a,b where a.khh =b.khh (+)右边的(+)是要显示出全部的a.khh,允许b.khh为空 要是改成a.khh(+)=b.khh and b.khh is null, 这句话肯定是FALSE,因为要查出全部的b.khh,而b.khh不可能为空。 另外not exists 的执行效率比NOT IN 高
from a,b
where a.khh =b.khh (+)
and b.khh is null
改用 not existsselect * from a
where not exists(select 1 from b where a.id=b.id)
from a,b
where a.khh =b.khh (+)右边的(+)是要显示出全部的a.khh,允许b.khh为空
要是改成a.khh(+)=b.khh and b.khh is null, 这句话肯定是FALSE,因为要查出全部的b.khh,而b.khh不可能为空。
另外not exists 的执行效率比NOT IN 高