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;

 

posted @ 2018-02-09 16:41  秦先生的客栈  Views(5397)  Comments(0Edit  收藏  举报