我正在尝试使用来自不同表的两个记录的总和来更新表中的记录。到目前为止,我有这个,但它似乎没有效果。
UPDATE StockCatalog
SET StockCatalog.ProductQuantity = (StockCatalog.ProductQuantity + DeliveryContent.DeliveryQuantity)
FROM StockCatalog
INNER JOIN DeliveryContent on StockCatalog.StockID = DeliveryContent.StockID
非常感谢任何帮助。感谢
答案 0 :(得分:1)
试试这个:
UPDATE StockCatalog
INNER JOIN DeliveryContent on StockCatalog.StockID = DeliveryContent.StockID
SET StockCatalog.ProductQuantity = (StockCatalog.ProductQuantity + DeliveryContent.DeliveryQuantity)