Instruction
Great! Of course, GROUPING SETS works with the GROUPING() function too:
SELECT DateReceived, CustomerId, RepairCenter, AVG(RepairDuration) AS AvgRepairDuration, GROUPING(DateReceived) AS D, GROUPING(CustomerId) AS C, GROUPING(RepairCenter) AS R FROM WarrantyRepair GROUP BY GROUPING SETS ( (CustomerId, RepairCenter), (DateReceived) )
Exercise
Find the average Interest amounts for the following grouping levels:
YearandQuarterCountry
Show the following columns in the query result: Year, Quarter, Country, AvgInterest, Y, Q, and C. The Y, Q, and C columns show if the columns Year, Quarter, and Country were used in the grouping.



