我有 2 个遇到问题的代码。我看了一些其他的答案,但完全糊涂了。这是SQL代码..(它是一个Access,SQL pass thru query)
UPDATE TOP (500) InventorySuppliers
SET BoydQuantityAvailable = SUM(Boyd0004Daily.QOH), Cost = Boyd0004Daily.Cost
FROM Boyd0004Daily INNER JOIN
InventorySuppliers ON Boyd0004Daily.LocalSKU = InventorySuppliers.LocalSKU
WHERE (InventorySuppliers.SupplierID = 4) AND (NOT (InventorySuppliers.BoydQuantityAvailable = SUM(Boyd0004Daily.QOH))) OR
(InventorySuppliers.SupplierID = 4) AND (NOT (InventorySuppliers.Cost = Boyd0004Daily.Cost))
它不喜欢 SUM(Boyd0004Daily.QOH) 上的更新,但在我的一生中,我无法弄清楚如何重写它,所以它进行选择,然后使用 1 个查询进行更新。