Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update column in Table1 with data from Table2
Message
From
17/11/2004 16:16:12
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Oracle
Miscellaneous
Thread ID:
00962384
Message ID:
00962402
Views:
8
Hello,

UPDATE Table1 SET Table1.Staff_ID = (SELECT Table2.KeyID FROM Table2 WHERE Table2.Location = Table1.Location)

if there is not a 100% 1-1 relation between the Location fields you might want to add

WHERE EXISTS (SELECT Table2.KeyID FROM Table2 WHERE Table2.Location = Table1.Location)

otherwise some rows might be overridden with NULL values

Regards

Christian
Previous
Reply
Map
View

Click here to load this message in the networking platform