Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating one table with data from another
Message
From
31/03/2001 15:27:50
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Updating one table with data from another
Miscellaneous
Thread ID:
00490636
Message ID:
00490636
Views:
43
Could someone please help me with a technique to update the fields in one record with the data from another record?

I have a student table with a cstud_key Primary Key. I have a second table called xstud which is an Excel import. The xstud table has a cstud_key foreign key, so the student table is linked to the xstud by the cstud_key. Both tables have a student ID field. I want to update the student table's cstud_id with the xstud's cstud_id value. Here is my attempt:

Use student in 0
Use xstud in 0
Update student set student.cstud_id=xstud.cstud_id where student JOIN xstud on student.cstud_key=xstud.cstud.key

or I have tried:

select student
replace student.cstud_id with xstud.cstud_id for student.cstud_key=xstud.cstud_key all

The latter attempt only replaces one value then stops.

This question is something that I know I will use frequently, so I want to understand how to do it. Thanks for your help.

Mike
Next
Reply
Map
View

Click here to load this message in the networking platform