Solved

how to get a list of inserted record in a table

Posted on 2009-04-11
2
278 Views
Last Modified: 2012-08-13
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.



0
Comment
Question by:busapps
2 Comments
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 24124769
"I am trying to get a list of all the inserted records into a table. " >>>select * from TABLE-NAME;

"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." >>> You mean you're doing something like
INSERT INTO TABLE2 SELECT  * FROM TABLE1; ?????

"Once I get all the newly inserted record I want to insert them into a 3 table." >> Does this mean you already have record in TABLE2 and you just want to insert newly added records to be taken to these three tables???

You may use LOAD DATA FILE  or the same INSERT INTO command with appropriate where condition.

Your Question Is Not Clear.
0
 
LVL 14

Expert Comment

by:racek
ID: 24124858
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

0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sql query on a varchar that is numeric. 8 43
MySQL  on Tomcat 8 68
AWS EC2 & RDS Instance 5 50
Showing random records from database 10 44
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question