View Single Post
  #2 (permalink)  
Old December 16th, 2008, 05:03 PM
dparsons dparsons is offline
Wrox Author
Points: 12,827, Level: 49
Points: 12,827, Level: 49 Points: 12,827, Level: 49 Points: 12,827, Level: 49
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
Send a message via AIM to dparsons
Default

Hmm. You don't want an insert you want an update (based upon your explanation you have said that the PartNo column in Table_New is already populated, you just need the corresponding flags from Table_Old)

In T-SQL the solution looks like this (Sorry I only know rudimentary PL-SQL but, i am imagining, the solution in Oracle would be similar):
sql Code:
UPDATE tnew
SET tnew.Flag1 = told.Flag1,
tnew.Flag2 = told.Flag2,
tnew.Flag3 = told.Flag3
FROM Table_New tnew
INNER JOIN Table_Old told ON tnew.Part_Num = told.Part_Num


If you really want an insert, something like this should work:

sql Code:
INSERT INTO Table_New (Part_Num, Flag1, Flag2, Flag3)
SELECT Part_Num, Flag1, Flag2, Flag3 FROM Table_Old;

The insert statement assumes that you truncate Table_New and insert the Part_Num from Table_Old into Table_New.

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
Reply With Quote
The Following User Says Thank You to dparsons For This Useful Post:
Nostromo77 (December 16th, 2008)