Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Statement Help
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00484934
Message ID:
00484958
Views:
15
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform