简单地说,我有以下每1分钟运行的事件:
UPDATE ticket SET status ='4'
WHERE duedate <= now()
现在我需要创建一个触发器,以便在update
出现insert
时将ticketID
票证datetime
与{{1}}一起发送到某个表格(活动表的种类) )。这可能吗?
答案 0 :(得分:1)
我认为这对你有用........
mysql> delimiter $$
mysql> CREATE TRIGGER Employee_Trigger
-> AFTER UPDATE ON employee
-> FOR EACH ROW
-> BEGIN
-> INSERT into Employee_log
-> (user_id, description)VALUES (user(),
-> CONCAT('Id with ',NEW.id,' is modified ',
-> ' from ',OLD.start_date, ' to ', NEW.start_date));
-> END$$
请参阅此链接(http://www.roseindia.net/sql/trigger/mysql-trigger-after-update.shtml)