Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating a table from another table
Message
 
 
À
12/03/2002 15:38:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00631739
Message ID:
00631887
Vues:
30
This message has been marked as the solution to the initial question of the thread.
Unfortunately, you cannot use UPADTE SQL Where clause to join tables. If you have compound index on the suniq and ident fileds than you can set relation from TableA to TableB and use REPLACE command to update TableA. Something like
SET ORDER TO < compound index on the suniq and ident fileds > IN TableA 
SELECT TableB
SET RELATION TO suniq + ident INTO TableA 
REPLACE FOR FOUND("TableA") ...
Or you can use SCAN
SELECT TableA
SCAN
  UPDATE TableB SET ... ;
     WHERE TableB.suniq = TableA.suniq AND TableB.ident = TableA.ident
ENDSCAN
Remember that expression in the WHERE clause doesn't join TableB and TableA but uses values from the current records in the TableA.

>Hello group,
>
>Is it possible to update the records in table b from table a. They would be linked by suniq and ident
>
>so something like
>
>update b
>set *
>where a.suniq = b.suniq and a.ident = b.ident
>
>I am not new at this but I do it so infrequently that I don't have a good understanding of it.
>
>Thanks
>Jim
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform