标签:style update inner from mount sum sele 更新 color
1、批量更新数据
UPDATE s_payablebill SP SET SP.AdjustAmount = (SELECT SUM(SA.Amount) FROM s_payablebill_adjust SA WHERE SA.PayableBillId = SP.PayableBillId) WHERE SP.PayableBillId IN (SELECT PayableBillId FROM s_payablebill_adjust GROUP BY PayableBillId)
=》
UPDATE s_payablebill SP INNER JOIN (SELECT PayableBillId, SUM(Amount) AdjustAmount FROM s_payablebill_adjust GROUP BY PayableBillId) SA ON SP.PayableBillId = SA.PayableBillId SET SP.AdjustAmount = SA.AdjustAmount
标签:style update inner from mount sum sele 更新 color
原文地址:https://www.cnblogs.com/blackarrow/p/9242635.html