Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grouping, counting and then grouping again
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Grouping, counting and then grouping again
Divers
Thread ID:
00217162
Message ID:
00217162
Vues:
37
I need to create an SQL query where I want to count the number of children on a table. However, I want to group the select before I do the count in order to avoid repetition of another field. How can I do this?

Example:

Main table: events
child table: order definition
grand child table: parts

An event may have many orders, and an order may have many parts.
I want to select the events, and a count of the orders. However for an order to be valid it must have at least one part. So, I created an INNER JOIN between order and parts and an INNER JOIN between events and orders, and I want a count of orders. However, I need to get only one count for each order, even if it has many parts.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform