sql not in 一个与直觉相反的问题
来源:互联网 发布:淘宝买家秀大尺度贴吧 编辑:程序博客网 时间:2024/05/22 14:40
select * from dual where
select * from dual where
select * from dual where 'wd06000174' not in (select zc.wlccidfrom c_zzcc zc)
不如这样 (select 1 from c_zzcc zc where
或 这样 select * from dual where
开始了:
select count(*) from j_yhda yhda where yhda.id in
( select x.yhid
)这个sql看着没错.但是是错的
正确应该这样写
select count(*) from j_yhda yhda where yhda.id in
( select x.yhid
)
原因是这样:
比如
not in 后面的表达式中的结果里不能有null
如上面的sql
这个问题没注意到的话会有这样的问题.有个值分明是不在某个表达式的结果中的(这个表达式的结果中有null)
所以呢用not in时候最好限制一下not null
- sql not in 一个与直觉相反的问题
- Join语句的on 与 select xxx in…
- 一个米农对 百度 与 谷歌 的评价 …
- access 转 SQL 要注意的问题
- Linux $( )与${ }的区别
-  
- “constructors not allowed …
- em的错误 <转载>
-
- Lesson 65 Not a baby 不是一个孩…
- 关于 page in page out
- HDOJ 1171 Big Event in HDU
- Oracle Null 与 in…
- sql 表连接, union
- sql sum 空或0
- SQL Server 安装 问题探讨
- sql注入 与 预防
- PANIC: Could not …
- 2014年10月15日
- 2014-10-15 17:29
- 我能做什么
- 我是个骄傲的intj
- 维基百科里 的intj &nbs…
- sql not in 一个与直觉相反的问题
- sql 调优 工具 准备
- oracle 查看执行计划
- oracle 使用explain plan分析查询…
- 2014年10月17日
- 2014年10月18日
- 今天周一
- 好渴望有时间能好好学习啊 啊…
- 果然,还是这样安心些