Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL: Getting records which is not in B From A ?
Message
De
16/08/1999 10:31:54
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
 
À
16/08/1999 10:15:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00254028
Message ID:
00254033
Vues:
26
>All,
>
>I have 2 tables that store a few number of records, A and B. A is a superset of B. For that, I need to perform a SQL Select to get the compliment of B.
>
>Examples, I have 10 records in A but 4 records in B. I need to display the rest of the 6 records which is not in B. I've tried using codes such as..
>
>SELECT * FROM A JOIN B ON Field_A!=Field_B
>
>However, it contains duplicate records because it searches from one record to another.
>
>Any idea for this? Or perhaps better way for not using SQL SELECT?
>
>Gan

Try using a Subquery

SELECT * FROM A WHERE Id NOT IN ( SELECT DISTINCT Id FROM B)
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform