Using Subqueries to Control the Scope of Aggregations