REPEAT UPDATE SQL语句 [英] REPEAT an UPDATE SQL statement

查看:84
本文介绍了REPEAT UPDATE SQL语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条SQL语句

update test_1 set `t_mark` = (`mark_1` + `mark_2` + `mark_3`)



完美运行,但我希望在添加新行时自动重复相同的语句。


which works perfectly but I want the same statement to repeat automatically when a new row is added.

推荐答案

为此目的使用MySql触发器: -



有关详细信息,请参阅以下链接: -

1] http://dev.mysql.com/doc/refman/ 5.0 / en / create-trigger.html [ ^ ]

2] http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html [ ^ ]

3] http://stackoverflow.com/questions/16892070/mysql-after-insert-trigger-which-updates-another-tables -column [ ^ ]
Use MySql Triggers for this purpose:-

for details see below links:-
1]http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html[^]
2]http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html[^]
3]http://stackoverflow.com/questions/16892070/mysql-after-insert-trigger-which-updates-another-tables-column[^]


这篇关于REPEAT UPDATE SQL语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆