DELIMITER $$$
DROP TRIGGER IF EXISTS `Event_au` $$$
CREATE TRIGGER `Event_au` AFTER UPDATE
ON `mm_Event` FOR EACH ROW
begin
    IF IFNULL(NEW.ceus, 0) != IFNULL(OLD.ceus, 0) THEN
        UPDATE `mm_EventAttendee` AS `ea`
        SET `ea`.`ceus` = NEW.ceus
        WHERE `ea`.`eventId` = NEW.id;
    END IF;
end $$$
DELIMITER ;

UPDATE `mm_EventAttendee` AS `ea`
JOIN `mm_Event` AS `e` ON `e`.`id` = `ea`.`eventId`
SET `ea`.`ceus` = `e`.`ceus`;

