Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question on appending records
Message
De
05/12/1998 22:26:46
 
 
À
04/12/1998 19:38:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00164360
Message ID:
00164504
Vues:
27
>>Bill,
>>Let's assume there is a unique key, UniqKey,
>>or some other way of positively identifying which
>>records in table1 are not in table2.
>>Try this:
>>
>>select * from table1 ;
>> where UniqKey not in ;
>> (select UniqKey from table2) ;
>> into cursor toappend
>>select table2
>>append from dbf('toappend')
>>
>>Good Luck,
>>Dore
>>
>>> have two identical tables in different directories. The
>>>data in the first table changes monthly and I will update
>>>the second table from it. I used a set relation statement,
>>>replace field data, etc. I also want to append records from the
>>>first table to the second table when there is no matching
>>>record in the second. I'm considerin a scan..endscand with
>>>an if statement based on a seek on the indexed field. Is
>>>there a better way? Some kind of SQL update maybe?
>
>
>You don't even need that:
>
>SELECT * FROM table1 UNION (SELECT * FROM table2) INTO TABLE combined
>
>If you leave the ALL off of the UNION you only get records that are different.

An excellent solution.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform