DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`movement_label_au` AFTER UPDATE ON `movement_label` FOR EACH ROW IF NEW.stem >= (SELECT Cantidad FROM Movimientos WHERE Id_Movimiento = NEW.Id_Movimiento) THEN UPDATE Movimientos SET OK = 1 WHERE Id_Movimiento = NEW.Id_Movimiento; END IF$$ DELIMITER ;