mysqlinsert触发器的创建

CREATE DEFINER=`wpsuper`@`%` TRIGGER `o2oinsert` BEFORE INSERT ON `t_s_o2o`
FOR EACH ROW begin


set New.fbianhao=(select fprojectval from t_billCodeRule where id=2 );        --更新当前数据的字段的值


update t_billCodeRule set fprojectval=fprojectval+1 where id=21;                --更新其他表的内容


end;

原文地址:https://www.cnblogs.com/xujiating/p/7171354.html