DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `pbx`.`sip_afterUpdate` AFTER UPDATE ON `sip` FOR EACH ROW BEGIN IF !(OLD.extension <=> NEW.extension) OR !(OLD.user_id <=> NEW.user_id) THEN INSERT IGNORE INTO `account`.userSync (`name`) SELECT `name` FROM `account`.`user` WHERE id = NEW.user_id; END IF; END$$ DELIMITER ;