2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-01-25 16:33:54 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `bs`.`clientNewBorn_beforeUpdate`
|
2024-01-15 11:31:03 +00:00
|
|
|
BEFORE UPDATE ON `clientNewBorn`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
-- Si ha pasado un año o mas
|
|
|
|
IF TIMESTAMPDIFF(YEAR,NEW.lastShipped, OLD.lastShipped) THEN
|
|
|
|
SET NEW.firstShipped = NEW.lastShipped;
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|