应该是满足kl.billno='2004080001'的记录被更新。
但最好写成这样:
update billdetail k1
set unitaccount =( select unitaccount from baseunitbank k2
where k1.unitcode = k2.unitcode
)
where k1.billno='2004080001' and exists(select 1 from baseunitbank k2 where k1.unitcode=k2.unitcode)
但最好写成这样:
update billdetail k1
set unitaccount =( select unitaccount from baseunitbank k2
where k1.unitcode = k2.unitcode
)
where k1.billno='2004080001' and exists(select 1 from baseunitbank k2 where k1.unitcode=k2.unitcode)
这样的话,就应该这么写
update billdetail k1
set unitaccount =( select unitaccount from baseunitbank k2
where k1.unitcode = k2.unitcode
)
where k1.billno='2004080001' and exists(select 1 from baseunitbank k2 where k1.unitcode=k2.unitcode)
update billdetail k1
set unitaccount =( select unitaccount from baseunitbank k2
where k1.unitcode = k2.unitcode and k1.billno='2004080001'
)
where exists(select 1 from baseunitbank k2 where k1.unitcode=k2.unitcode and k1.billno='2004080001') 给分