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
时间: 2024-10-19 22:40:27