Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find records not in another table
Message
From
01/06/2010 10:56:52
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01466852
Message ID:
01466865
Views:
39
>All I want to do is hav an SQL statement that gets a list of items from the main item table,but not list items already selected in the other table.
>
>Any ideas?
>Mike

You can either use a subquery:
select * from Table1;
  where KeyField not in (select KeyField from Table2)
Or do an outer JOIN, in which case the non-matching records have null values:
select Table1.KeyField, Table2.FieldX, Table2.FieldY;
  from Table1 left join Table2 on Table1.KeyField = Table2.KeyField;
  where isnull(Table2.KeyField)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform