update IQAlarm
set IQAD=GETDATE(),AD=AD+1
where exists (select CPC from Inquiry where Inquiry.IQST='ooo'
and DATEDIFF(DAY,GETDATE(),Inquiry.QDL)<=3 and Inquiry.CPC = IQAlarm.CPC);
insert into IQAlarm (CPC)
select CPC from Inquiry
where not exists (select CPC from Inquiry where Inquiry.IQST='ooo'
and DATEDIFF(DAY,GETDATE(),Inquiry.QDL)<=3 and Inquiry.CPC = **IQAlarm.CPC**);
更新工作正常,但插入会产生此错误:
无法绑定多部分标识符“IQAlarm.CPC”。