首页 > 代码库 > 谈NOT IN和Exists
谈NOT IN和Exists
Select count(1) From eemployee where status=1 and eid not in (select eid from CBENEFIT_STATUS)居然一条记录都没有?是因为select eid from CBENEFIT_STATUS 中eid为空解决方法: 1/ 改为select eid from CBENEFIT_STATUS where eid is not null -- where eid is not null Select count(1) From eemployee where status=1 and eid not in (select eid from CBENEFIT_STATUS where eid is not null) 2/ select * from table1 A where not exists (SELECT * FROM table2 B where B.col1=A.col1) Select count(1) From eemployee a where status=1 and not exists (select 1 from CBENEFIT_STATUS b where a.eid = b.eid)参考网址:http://x-spirit.iteye.com/blog/615603
谈NOT IN和Exists
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。