Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INNER JOIN UPDATE
Message
 
À
29/03/2001 20:28:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00490125
Message ID:
00490215
Vues:
10
I usually add a FOR !EOF(tablename) with tablename being the table the values are coming from the make sure that I don't stomp on records that don't have a correlating record in the other table.

PS, I like your tag, but true insanity is getting different results each time.

>>I'm trying to build a query which will update one table with values from another, matching on primary keys. It's very simple in ACCESS using an INNER JOIN with an UPDATE. I haven't been able to get it to work in VFP. Can it be done?
>>
>>Thanks!
>
>Nope.
>What can be done, though, is to use a SET RELATION between the tables and a REPLACE ALL. This works very fast.
>
>e.g. This will update the UpdateMe table from values in SourceTable
>where the primary keys match.
>
>Use SourceTable Order idPK
>Select 0
>Use UpdateMe
>Set Relation To idPK Into SourceTable
>Replace All field1 With SourceTable.field1, ;
>            field3 With SourceTable.field2, ;
>            etc., etc. ;
>    For !EOF("SourceTable")
Cy Welch
Senior Programmer/Analyst
MetSYS Inc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform