我编写了以下更新语句来更新 PLN_DU_Vendor 表的 StatusID。
UPDATE
PLN_DU_Vendor
SET
PLN_DU_Vendor.StatusID = 2
FROM
PLN_DU_Vendor
INNER JOIN PMT_RFDDetail D ON PLN_DU_Vendor.DUID = D.DUID
INNER JOIN PMT_RFDHeader H ON H.RFDID = D.RFDID AND PLN_DU_Vendor.VendorID = H.VendorID
INNER JOIN PLN_LASCO_Header LH ON LH.LASCOID = H.LASCOID AND LH.ReleaseID = PLN_DU_Vendor.ReleaseID
AND PLN_DU_Vendor.VendorDUQuantity = (D.DespatchQuantity + ISNULL(PLN_DU_Vendor.RFDQuantity, 0))
WHERE
H.RFDID = 10
如果条件
PLN_DU_Vendor.VendorDUQuantity = (D.DespatchQuantity + ISNULL(PLN_DU_Vendor.RFDQuantity, 0))
失败,我需要将 StatusID 更新为 1。如何在同一更新选择语句中执行此操作。