Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying all of the data from related tables

Status
Not open for further replies.

TomBarrand

Programmer
Aug 9, 2000
162
GB
My db consists of some of these tables and fields:

Purch_Ord_Hdr table Purch_Ord_Line table
Purch_Ord_No Purch_Ord_Line_No
Revision_No Purch_Ord_No
Status Revision_No

FOB table
FOB_No
Purch_Ord_Line_No
FOB_Date

What I would like to do is select all of the data from all of these tables that relates to a specific Purch_Ord_No and Revision_No and insert the data into all of the tables.

I can do this for Purch_Ord_Hdr and Purch_Ord_Line using INSERT INTO SELECT statement and replacing the Revision_No, but I can not do this for the FOB as this is related at Purch_Ord_Line level. If I use the same technique for the FOB table what actual happens is that new records are added to the FOB table, but they relate to the old Purch_Ord_Line_No 's as oppossed to the new Purch_Ord_Line_No. Any suggestions would be appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top