Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing 2 tables using SQL Select
Message
From
09/10/2003 06:14:52
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00836676
Message ID:
00836693
Views:
10
Hi John

>I have two tables, one local (table A) and one via a remote view (table B). I want to perform comparisons of their contents using SQL select to show:
>
>1.) items in A and B
>2.) items in A but not in B
>3.) items in B but not in A
>
>I have no problem with the first, but am having touble setting up conditions for 2 and 3.

YOu can use a sub-query to do this:
Thus:
SELECT * ;
FROM A ;
WHERE a.keyfield NOT IN (SELECT keyfield FROM B)

Gets you all items in A that are not in B and the reverse gets you the other set (in B but not in A)
----
Regards
Andy Kramek
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform