MySql触发器语句
Posted mr-xy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 ;
以上是关于MySql触发器语句的主要内容,如果未能解决你的问题,请参考以下文章