问题描述
这是可能在特定列设置一个触发.eg我有一个表名product_deals
is this possible to set a trigger on a specific column .eg i have a table name product_deals
在那里,我储存处理信息。所有领域,从通过AJAX前端侧更新..只有最后一列当我点击然后计算页面刷新其交易的最终价格。
there i store deal info.. all field are updated from front-end side through ajax.. only last column updated when i click save button then calculation is performed after page refresh which is deals final price..
现在...重视拍摄到数据库。
now because of ajax... values shoot to DB..
有没有什么办法可以在一个特定的列设置触发器。
is there any way to set trigger on a specific column..
我是新来触发y的小知识..需要专家的意见。
i am new to trigger that y have little knowledge.. need expert advice..
干杯
编辑:我想设置final_price列触发
edit: i want to set trigger on final_price column
推荐答案
您可以设置更新,然后里面触发单向触发,看是否指定列改为
You can set a trigger on UPDATE and then inside the trigger check to see if the specified column was changed
CREATE TRIGGER sample_trigger AFTER UPDATE ON product_deals
FOR EACH ROW
BEGIN
IF NEW.final_price <> OLD.final_price THEN
// put your code here
END IF
END;
这篇关于mysql的触发 - 当特定的列值发生改变,然后运行触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!