Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating one table with data from another
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00490636
Message ID:
00490641
Vues:
9
>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

Try this:

update student set student.cust_id = xstud.cust_id where student.cstud_key = xstud.cstud_key

You should'nt need a JOIN.

If that doesn't give the result you want, use a scan loop. The reason I do a scan on small tables is it allows me to come back to the same code later and change other fields without having to rewrite my sql.
select student
scan
    if seek(cstud_key,xstud)
        replace student.cust_id with xstud.cust_id
    endif
    select student
endscan
If your tables are indexed, this would update every student at the largest university in America in a second or two.

HTH
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform