oracle中not in 和 in的代替用法

-- not in 的替代写法
select col from table1 where col not in
(select col from table2);

select col,table2.col temp_col
from table1 left join table2
on table1.col = table2.col
where temp_col is null;

-- in 的替代写法
select col from table1 where col in
(select col from table2);

select col,table2.col temp_col
from table1 left join table2
on table1.col = table2.col
where temp_col is not null;

 

转载:https://www.cnblogs.com/qinjf/p/8436109.html

posted @ 2019-12-06 14:04  ConfidentLiu  阅读(4202)  评论(0编辑  收藏  举报