Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Count Children in SQL Select
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00015517
Message ID:
00015528
Vues:
39
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform