Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating one table with data from another
Message
De
31/03/2001 15:27:50
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Updating one table with data from another
Divers
Thread ID:
00490636
Message ID:
00490636
Vues:
42
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform