数据库
首页 > 数据库> > MySql触发器语句

MySql触发器语句

作者:互联网

删除

Drop trigger tri_cus_wallet_update;

 

创建

DELIMITER $
CREATE TRIGGER tri_cus_wallet_update AFTER  UPDATE ON cus_wallet FOR EACH ROW
BEGIN
INSERT INTO cus_wallet_his(
orgid,
userid,
rechargemoney,
subsidymoney,
totalmoney,
integral,
rechargemoney_new,
subsidymoney_new,
totalmoney_new,
create_user,
create_time,
update_user,
update_time,
reserve1
)values(
OLD.orgid,
OLD.userid,
(NEW.rechargemoney-OLD.rechargemoney),
(NEW.subsidymoney-OLD.subsidymoney),
OLD.totalmoney,
OLD.integral,
NEW.rechargemoney,
NEW.subsidymoney,
NEW.totalmoney,
OLD.create_user,
now(),
OLD.update_user,
now(),
NEW.reserve1
);
END $
DELIMITER ;

标签:语句,触发器,OLD,update,cus,subsidymoney,MySql,rechargemoney,NEW
来源: https://www.cnblogs.com/Mr-xy/p/11653771.html