Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update column in one table with data from other table
Message
From
26/11/2004 05:56:45
 
General information
Forum:
Oracle
Category:
PL/SQL
Miscellaneous
Thread ID:
00962381
Message ID:
00964874
Views:
8
This message has been marked as the solution to the initial question of the thread.
>I need to update a column in one table with data from another table, but I can not get the syntax right. Basically what I want to do is:
>
>UPDATE Table1
>SET Table1.Staff_ID = Table2.KeyID
>WHERE Table1.Location = Table2.Location
>
>The Location column in each table is unique. TIA!

Try this

UPDATE table1
SET staff_id = (SELECT keyid
FROM table2
WHERE table2.keyid = table1.staff_id
AND table2.location = table1.location)

Or perhaps a derivitive of this.

HTH,
William Chadbourne
Senior Programmer/Analyst
State of Maine - DAFS App Team

Oracle - When you care enough to use the very best!!
Previous
Reply
Map
View

Click here to load this message in the networking platform