Solved

Copy data from one table to another

Posted on 2008-06-11
2
192 Views
Last Modified: 2010-04-21
I have two tables, i need to copy data from one to another, below are the table names and field names, they are in the order in which they should be copied, like cases.id should be copied to activities.caseid, etc ...

table 1: cases

id, firmid, inscasenum, aosfiledat, i140filingdate, approvaldate, expdate, 1

table 2:  activities

caseid, firmid, actdesc, dateinitiated,lastmodified,schdemailon, complete

ONLY where cases.InsCaseNum is not null

How can I do this ?
0
Comment
Question by:amucinobluedot
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 21760601
simple insert:
INSERT INTO activities ( caseid, firmid, actdesc, dateinitiated,lastmodified,schdemailon, complete )
 SELECT id, firmid, inscasenum, aosfiledat, i140filingdate, approvaldate, expdate, 1
   FROM cases
  WHERE cases.InsCaseNum is not null

Open in new window

0
 

Author Closing Comment

by:amucinobluedot
ID: 31466177
thx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

713 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