Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vfp sql question
Message
 
À
28/09/2000 12:01:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00420493
Message ID:
00422111
Vues:
10
>>>I am trying just to grab a person with a address, but I get several records for a person with several address records. I generally have to create a index on the id unique and that works fine.
>>
>>Are you trying to get just one shipping address for each person, or are you trying to get just the people with AT LEAST one shipping address, in other words excluding people who have no shipping addresses?
>
>I am just grabing people with at least one address record, excluding all
>people with no address records.

Try this to get just the people with at least one address record:

SELECT ID ;
FROM PERSONS ;
WHERE ID IN (SELECT ID FROM ADDRESS) ;
INTO TABLE Q1

To get people without any addresses at all, just add the NOT clause:

SELECT ID ;
FROM PERSONS ;
WHERE ID NOT IN (SELECT ID FROM ADDRESS) ;
INTO TABLE Q1
Chris McCandless
Red Sky Software
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform