Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique Record Table
Message
 
À
16/07/1997 21:46:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00040341
Message ID:
00040463
Vues:
24
>As part of my thesis at Navy Postgraduate School, I have a genetic algorithm that runs in MS VFP 5.0. The output of the GA is a table with approximately 15 fields and usually about 5000 unique records. Every time I run the GA, I save the output in a table archive. Now, I have approximately 20 tables in the archive.
>
>I would like to create a new table which retrieves only the unique records from each of these 20 archived tables. There are no repeat records within each table. Again, each table has the same structure. I have tried appending records, which works, but it does not eliminate repeats. Is there a way of automatically eliminating repeats after the appendage? Or is there a method of using the 'join' (or some other) feature to do this? For each table, there is approximately 20%-30% intersection, so doing it manually is out of the question.
>
>Thank you,
>LT Jason W. Carter
>U.S. Navy

LT. Jason,

You need to union all of those tables together. Sicne you can only union up the five in any select command this will require more than one opreation. Something like this would work (aasuming the table names are data01, data02, etc..;

SELECT * FROM Data01 ;
UNION DISTINCT ;
SELECT * FROM Data02 ;
INTO CURSOR Result1

SELECT * FROM Result1 ;
UNION DISTINCT ;
SELECT * FROM Data03 ;
INTO CURSOR Result2

SELECT * FROM Result2 ;
UNION DISTINCT ;
SELECT * FROM Data04 ;
INTO CURSOR Result3

etc. until you have rpocessed all of the tables. If you want the final result to be permanent table then on the last SELECT change the INTO CURSOR to INTO TABLE.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform