Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update column in one table with data from other table
Message
De
26/11/2004 05:56:45
 
 
Information générale
Forum:
Oracle
Catégorie:
PL/SQL
Divers
Thread ID:
00962381
Message ID:
00964874
Vues:
7
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!!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform