Reputation: 15
I have two data base A & B, in each one I have a table called answer, I want to use the 2nd one as an archive table, I want to create a trigger that copies the last inserted row in A.answer to B.answer.
Here what I did
CREATE TRIGGER `a` AFTER INSERT ON `A`.`answer`
FOR EACH ROW INSERT INTO `B`.`answer` SELECT * FROM `answer`
This trigger works, but copy all the answers inserted in A.answer to B.answer. The problem is : I dont want to copy all answers, but only the last one. (remark : I dont know the id of the inserted answer, so dont tell me to add a ' WHERE answer.id = xx '). Thanks for your help
Upvotes: 0
Views: 118