您的位置:首页 > 数据库 > Oracle

sql server中in和exists的小区别 oracle未测试

2009-10-28 16:34 731 查看
in 的话, 如果是null 就不比较了,既不是in 也不是 not in

exists的话 因为用 = 加在条件里比较了,所以 null 是 not exists

select *
from pricetemp
where cast(商品コード as varchar(10))not in(
select shohin_cd
from m_price)

select *
from pricetemp
where not exists (select shohin_cd
from m_price

where cast(pricetemp.商品コード as varchar(10))=m_price.shohin_cd)

以上2条会有不同的结果,因为 pricetemp.商品コード 有很多 null
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: