DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ektEntryAssign_afterUpdate` AFTER UPDATE ON `ektEntryAssign` FOR EACH ROW BEGIN IF NOT(NEW.`ref` <=> OLD.`ref`) OR NOT(NEW.`entryFk` <=> OLD.`entryFk`) THEN UPDATE entry SET reference = NEW.`ref` WHERE id = NEW.entryFk; END IF; END$$ DELIMITER ;