mysql trigger
触发器的使用
注意前后加加
delimiter $$
....................
$$ delimiter ;
#修改a.dealer 表信息时,更新b.dealer delimiter $$ CREATE TRIGGER syncInfoByUpdateA AFTER UPDATE ON A.table1 FOR EACH ROW BEGIN DECLARE brandid INT(4); set brandid = (select id from A.brand where uniqueid = NEW.branduniqueid); update B.table1 set `Name` = NEW.name, `BrandId` = brandid, `Remark` = `insert trigger` where uniqueid = NEW.hyuniqueid; END$$ delimiter ;