Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp sql question
Message
 
To
28/09/2000 12:01:26
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00420493
Message ID:
00422111
Views:
11
>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform