I have two tables. First table is Shipping with columns Product, Quantity and ID. Second table is Inventory with columns Product and Total.
I want to take the value of Shipping.Quantity and subtract it from the value in Inventory.Total WHERE the Product values match in each table and Shipping.ID is value in url ($onum). Then I want to set the new value as Inventory.Total for that product.
Best I could come up with:
UPDATE Inventory.Total
CROSS JOIN Shipping
SET Inventory.total=(Inventorytotal-Shipping.Quantity)
WHERE Inventory.Product=Shipping.Product
AND Shipping.ID=$onum
1 Answer