not in 和 not exists 区别
来源:互联网 发布:淘宝led散热片 编辑:程序博客网 时间:2024/06/07 01:09
select * from TableA a where not exists (select b.AId from TableB b where b.AId=a.id)等价
select * from TableA a where a.id not in(select b.AId from TableB b where b.AId is not null and b.AId !='')
注意:
如果去掉红色部分约束条件,当查询集合(select b.AId from TableB b)中没有null和空字符串时,
select * from TableA a where a.id not in(select b.AId from TableB b)查询结果正确
若查询集合(select b.AId from TableB b)中 有null或空字符串时
,
select * from TableA a where a.id not in(select b.AId from TableB b)查询结果为null
阅读全文
0 0
- in 和 exists 区别,not in和not exists区别
- not in和not exists的区别
- not in 和 not exists 区别
- exists,in 和 not in ,not exists
- not exists 和not in
- not in 和 not exists
- 关于sql not in 和not exists 区别和用法
- 对于not in 和 not exists的性能区别:
- oracle-not in 和not exists的区别
- NOT In和NOT EXISTS使用的区别
- exists 和not exists 用法简介及与IN和not In的区别
- exists 和not exists 用法简介及与IN和not In的区别
- NOT EXISTS and NOT IN区别
- not in与not exists的区别
- not in 与not exists区别
- not in与not exists的区别
- oracle中in,not in和exists,not exists之间的区别
- oracle中in,not in和exists,not exists之间的区别
- 基数排序
- MongoDB开发学习(2)索引的基本操作
- HDU6172-Array Challenge
- [py]一步一步实现tornado form验证
- 分布式应用系统服务器上下线动态感知程序开发学习笔记
- not in 和 not exists 区别
- mongodb常用命令
- python中文件基本操作
- keilc 4 编译出现的几个错误解决
- QT5.9 在线程中导出EXCLE报 CoCreateInstance failure (尚未调用 CoInitialize) 解决办法
- CFGym 101002C 状压DP
- oracle内置函数
- python之Flask(一)
- 【LeetCode】572. Subtree of Another Tree