select count(*) from #ddd d where not exists (select 1 from #ccc c where d.job_Number=c.job_Number)
delete from #ddd d where not exists (select 1 from #ccc c where d.job_Number=c.job_Number)
select....已經找出對應的數據
delete...出錯,要怎樣修改刪除語句?
刪除找到的數據
------解决方案--------------------
去掉#ddd 后面的 d 就可以了
delete from #ddd where not exists (select 1 from #ccc c where c.job_number = #ddd.job_number)