Guest User

Untitled

a guest
Dec 6th, 2019
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GO
  2. CREATE TRIGGER update_amount_sell ON tblHas after INSERT AS
  3. BEGIN
  4.     UPDATE tblSell
  5.     SET tblSell.amount = tblSell.amount - (
  6.         SELECT amount
  7.         FROM inserted
  8.         WHERE idShop = tblSell.idShop AND idProduct = tblSell.idProduct
  9.     )
  10.     FROM tblSell
  11.     JOIN inserted ON tblSell.idProduct = inserted.idProduct AND tblSell.idShop = inserted.idShop
  12. END
RAW Paste Data