Insert after update trigger
Posted: Fri Nov 17, 2006 10:29 pm
Hi,
I need some help with the following trigger (I am getting error at INSERT INTO line):
I have two tables: orders and order tracking.
Once the user update the order, I want to insert the data in order tracking table.
Order table fields that I want to insert in order tracking are: order_id, update_start, user_comments, updateStatus_id
Order tracking fields : order_track_id (auto increment), order_id, Start_time, comments, status_id
Any help is appreciated.
Thanks,
I need some help with the following trigger (I am getting error at INSERT INTO line):
I have two tables: orders and order tracking.
Once the user update the order, I want to insert the data in order tracking table.
Order table fields that I want to insert in order tracking are: order_id, update_start, user_comments, updateStatus_id
Order tracking fields : order_track_id (auto increment), order_id, Start_time, comments, status_id
Code: Select all
CREATE TRIGGER auInsertrack
AFTER UPDATE ON
order FOR EACH ROW BEGIN
INSERT INTO order_tracking SET comments=NEW.user_comments,
Start_time=NEW.update_start, status_id=NEW.updateStatus_id
Where order_tracking.order_id=NEW.order_idThanks,