码迷,mamicode.com
首页 > 数据库 > 详细

oracle中not in 和 in 的替代写法

时间:2018-02-09 20:21:00      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:where   bsp   body   class   写法   gpo   ble   ora   col   

 

-- 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 的替代写法

标签:where   bsp   body   class   写法   gpo   ble   ora   col   

原文地址:https://www.cnblogs.com/qinjf/p/8436109.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!