Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count Children in SQL Select
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00015517
Message ID:
00015528
Views:
37
>I have a parent child one to many setup
>key on an index field called locindex.
>
>Parent
>
>locindex N 6
>Station C 12
>
>
>Child
>locaindex N 6
>Qty N 6
>Price N 6
>
>I would like to know of an SQL (2.6A FoxPro Windows) Select statement that will give me all of
>the data in parent and child for only those parents with
>more than one child.
>
>Hope you all can help...TIA

Select parent.* ;
from parent,child ;
where parent.locindex=child.locindex ;
group by child.locindex ;
having count(*)>1

If you need in child data you can select into cursor and then join to child table without grouping.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform