Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Statement Help
Message
 
 
À
14/03/2001 12:11:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00484934
Message ID:
00484958
Vues:
14
>What is the syntax for a select statement where I want to select all the records in table1 that don't exist in table2
>
>Thanks

You can use a simple subquery.
select t1.* from table1 t1 where t1.key not in (select t2.key from table2 t2)
If your definition of existing is based on multiple fields, you can concatenate them in your subquery.
select * from table1 t1 where t1.field1+t1.field2+t1.field3 not in ;
   (select t2.field1+t2.field2+t2.field3 from table2 t2)
If the fields are not the same datatype, you can use transform() to convert them to character.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform