Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing 2 tables using SQL Select
Message
De
09/10/2003 06:14:52
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00836676
Message ID:
00836693
Vues:
11
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform