Answer the question
In order to leave comments, you need to log in
MySQL and insert trigger
I interpose in the first table record. It also has an “after insert” trigger that adds an id from the first table to the second. How to implement it?
If I interpose in the trigger request: INSERT INTO table2 VALUES (table2.id = LAST_INSERT_ID()); - "1" is added.
If the query is: INSERT INTO table2 VALUES (table2.id = new.id); - "0".
Answer the question
In order to leave comments, you need to log in
Ubuntu 10.01 + MySQL 5.1.49, works fine via
INSERT INTO table2 (id) values (NEW.id);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question