1. 程式人生 > >oracle中not in 和 in 的替代寫法

oracle中not in 和 in 的替代寫法

clas left join lec body post tab temp bsp blog

-- 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;

oracle中not in 和 in 的替代寫法