Solved

how to get a list of inserted record in a table

Posted on 2009-04-11
2
276 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now