select count(job_Number) from #ddd
select count(job_Number) from #ccc
select count(*) from #ddd d where d.job_Number in (select job_Number from #ccc)
select count(*) from #ddd d where d.job_Number not in (select job_Number from #ccc)
分別返回
584080
50286
277130
0
在這裏為什麼in有數據,not in 沒有數據呢?
------解决方案--------------------
select count(*) from #ddd d where not exists (select 1 from #ccc where d.job_Number=job_Number)