mysql 数据库 trigger 触发器的使用
作者:互联网
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 ;
标签:触发器,set,brandid,delimiter,trigger,mysql,NEW 来源: https://www.cnblogs.com/haoliansheng/p/16074693.html