This commit is contained in:
Carlos Jimenez Ruiz 2019-02-01 12:48:03 +01:00
commit d235495658
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
DROP TRIGGER IF EXISTS `vn2008`.`expeditionsBeforeDelete`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`expeditionsBeforeDelete`
BEFORE DELETE ON `expeditions` FOR EACH ROW
BEGIN
UPDATE Tickets SET Bultos = (SELECT COUNT(counter)-1
FROM expeditions WHERE ticket_id = OLD.ticket_id and EsBulto)
WHERE Id_Ticket = OLD.ticket_id;
END$$
DELIMITER ;