Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grouping, counting and then grouping again
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Grouping, counting and then grouping again
Miscellaneous
Thread ID:
00217162
Message ID:
00217162
Views:
39
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.
Next
Reply
Map
View

Click here to load this message in the networking platform