2
我寫了下面的更新語句來更新PLN_DU_Vendor表的StatusID。在SQL Server中更新Select Case語句:
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.如何在相同的更新SELECT語句做到這一點。
什麼是「PLN_DU_Vendor.VendorDUQuantity」的數據類型? –
VendorDUQuantity,DespatchQuantity和RFDQuantity的數據類型爲十進制(15,3) – thevan