Reputation: 25
I am attempting to update a record in my table with the sum of two records from different tables. So far I have this however it doesnt appear to work.
UPDATE StockCatalog
SET StockCatalog.ProductQuantity = (StockCatalog.ProductQuantity + DeliveryContent.DeliveryQuantity)
FROM StockCatalog
INNER JOIN DeliveryContent on StockCatalog.StockID = DeliveryContent.StockID
Any help would be much appreciated. Thanks
Upvotes: 2
Views: 38
Reputation: 1093
try this:
UPDATE StockCatalog
INNER JOIN DeliveryContent on StockCatalog.StockID = DeliveryContent.StockID
SET StockCatalog.ProductQuantity = (StockCatalog.ProductQuantity + DeliveryContent.DeliveryQuantity)
Upvotes: 1