原SQL
UPDATE CW_PZ1_CSH SET CW_PZ1_CSH.NCCFLAG=NULL
from CW_PZ1_CSH INNER JOIN CSH_ztpzkey
ON CSH_ztpzkey.zt_no =CW_PZ1_CSH.ZT_NO AND CSH_ztpzkey.pz_key = CW_PZ1_CSH.PZ_KEY
AND CW_PZ1_CSH.NCCFLAG IS NOT NULL
正确的SQL
UPDATE CW_PZ1_CSH
SET CW_PZ1_CSH.NCCFLAG= (select nccflag from CSH_ztpzkey where CSH_ztpzkey.zt_no =CW_PZ1_CSH.ZT_NO AND CSH_ztpzkey.pz_key = CW_PZ1_CSH.PZ_KEY )
where exists (select 1 from CSH_ztpzkey where CSH_ztpzkey.zt_no =CW_PZ1_CSH.ZT_NO AND CSH_ztpzkey.pz_key = CW_PZ1_CSH.PZ_KEY )AND CW_PZ1_CSH.NCCFLAG IS NOT NULL