Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select records exceot ones referenced in another table?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00299325
Message ID:
00299330
Vues:
27
>Is there a way to combine SEEK with SELECT (or a better way) to select records EXCEPT for those referenced in another table?
>
>I have two tables:
>
>The main table contains all records indexed by an ID field.
>
>The second table contains the IDs of records from the first table that have already been processed, also indexed by the ID field.
>
>I wish to select all records from the first table EXCEPT those for which the ID is listed in the second table.
>
>It would seem that a statement such as this should work:
>
>
>SELECT  (fieldnames);
> FROM  main_table;
> WHERE (search criteria);
>   AND NOT SEEK(done_table.id);
>   into cursor c_results
>
>
>I'm obviously overlooking something....
>
>All assistance appreciated!
>
>Thanks,
>
>Neil Preston

You need a nested subquery...

select id from table1 where id not in(select id from table2)

HTH
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform