create trigger on update to insert old values into other table in MYSQL

Viewed 12996

I have two tables. The first is my person table which has id, name, creation_date as values, I have a old_person table (id, name, modified_date) which I want to populate the value of person before it actually changes. How would I go about that? I have tried triggers but failed.

I tried as follows

create trigger Person_Trigger Update on person
before update
as
insert into old_person(id, name, modified) 
select id, new.name, getdate()
from person

It's giving me syntax errors...Not many Trigger references out there either, a little push would be greatly appreciated!

2 Answers
Related