Solved

how to get a list of inserted record in a table

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

11 Experts available now in Live!

Get 1:1 Help Now