Link to home
Start Free TrialLog in
Avatar of busapps
busapps

asked on

how to get a list of inserted record in a table

I am trying to get a list of all the inserted records into a table. The records that are getting inserted  into the current table is via a select query that groups records from another table and inserts them into the current table.

Once I get all the newly inserted record I want to insert them into a 3 table.



ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
USE INSERT TRIGGER
http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html
delimiter |
 
CREATE TRIGGER yourTrigger AFTER INSERT ON tab1
  FOR EACH ROW BEGIN
    INSERT INTO table2 SET col1 = NEW.co1, col2 = NEW.co2;
    INSERT INTO table3 SET col1 = NEW.co1, col2 = NEW.co2;
  END;
|

Open in new window