Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A simple SQL but with the count of the child records
Message
De
20/08/2006 22:47:15
 
 
À
20/08/2006 22:44:11
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
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:
01147169
Vues:
20
>I think the basic idea is something like this:
>
>
>select Master.Master, count(*) as HowMany;
>  from Master join Child on Master.Master = Child.Master;
>  group by Master;
>  into cursor Temp
>
>
>Additional adjustments may be needed if there is the possibility of master records without child records. A left join, for a start.

Yes, this works if I only have one field to use. But, using that approach when I have a lot of fields from the master table to include in the SQL will produce a SQL error on the GROUP BY.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform