salix/db/routines/vn/triggers/saleLabel_afterUpdate.sql

8 lines
301 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleLabel_afterUpdate`
AFTER UPDATE ON `vn`.`saleLabel`
FOR EACH ROW
IF NEW.stem >= (SELECT s.quantity FROM sale s WHERE s.id = NEW.saleFk) THEN
UPDATE sale s SET s.isPicked = TRUE WHERE s.id = NEW.saleFk;
END IF$$
DELIMITER ;