Solved

how to get a list of inserted record in a table

Posted on 2009-04-11
2
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Accepted Solution

by:
K V 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 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