Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A simple SQL but with the count of the child records
Message
 
 
À
20/08/2006 22:14:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01147165
Message ID:
01147174
Vues:
22
This message has been marked as the solution to the initial question of the thread.
>I have a one to many relationship. From the master table, I am selecting all the records. But, for each record in the SQL result, I need to also include the number of child records. Anyone would have a quit example on how to achieve that?
select Master.*, step1.CountChildren from Master ;
inner join ;
(select MasterID, count(*) as CountChildren from Child group by masterID) step1 ;
on Master.MasterID = step1.MasterID
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform