Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excluding records in a JOIN
Message
From
24/10/2008 12:30:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
24/10/2008 12:22:24
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01356965
Message ID:
01356969
Views:
22
>How do select from TableA, and exclude records that match TableB?

Two options.
* 1.
select * from TableA;
  where KeyField not in (select KeyField from TableB)
The second option is a little more involved; I'll just outline the basic principle.

It consists of doing an outer join (...from TableA left join TableB on TableA.KeyField = TableB.KeyField...) Now, any field you include from TableB will have a NULL value if there is no match.
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