Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
339 B
3
Indexable
Never
CREATE TRIGGER `After insert query` AFTER INSERT ON `table3`
 FOR EACH ROW BEGIN
UPDATE table1 SET table1.price = NEW.price WHERE table1.sku = NEW.sku;

UPDATE table2 SET table2.quantity = NEW.quantity WHERE table2.product_id =(SELECT product_id FROM table1 WHERE table1.sku = NEW.sku limit 1);

DELETE from table3 where sku = NEW.sku;
END