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

8 lines
299 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`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 ;