Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare contents of two dbfs
Message
De
23/04/2003 21:25:16
 
 
À
23/04/2003 13:04:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00780688
Message ID:
00780951
Vues:
11
>Hi,
>
>I would like two compare the contents of two dbf tables. I would like to update table1 with the contents of certain fields in table2, if an new record exists within table2.
>
>I don't know how to begin, any suggestions are appreciated.
>
>Thank you,

This is one of the new capabilities introduced in VFP8. I don't know how fast this query will be for large tables.
*-- field: f1 being the common field between the two tables
use table1 in 0 && has fields: f1, f2, f3
use table2 in 0 && has fields: f1, f2, f3

*-- add all records in table2 that are not in table1 based
*-- on field: f1. This is important as this query will not
*-- add a duplicate record from table2 to table1 if F1 already
*-- exists in table1.
insert into table1 (f1,f2) ;
  select f1,f2 from table2 ;
  where f1 not in ;
    (select f1 from table1)
HTH.
ramil
~~ learning to stand still
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform