私は2つのテーブルを持っています。最初のテーブルにはShipping、列Product、QuantityおよびがありIDます。2 番目のテーブルにはInventory、列ProductとがありますTotal。
の値を取得し、値が各テーブルで一致し、urlの値であるWHERE の値Shipping.Quantityから減算したい( )。次に、その製品の Inventory.Total として新しい値を設定します。 Inventory.TotalProductShipping.ID$onum
私が思いつくことができる最高のもの:
UPDATE Inventory.Total
CROSS JOIN Shipping
SET Inventory.total=(Inventorytotal-Shipping.Quantity)
WHERE Inventory.Product=Shipping.Product
AND Shipping.ID=$onum