Analyzes data in one of two possible ways:
- In a single dimension without performing a full ROLLUP.
- In multiple dimensions without performing a full CUBE.
ANSI Compliance
GROUPING SETS is ANSI SQL:2011 compliant.
SAMPLE Clause and GROUPING SETS
You cannot specify a SAMPLE clause in a query that also specifies the GROUPING SETS option in a GROUP BY clause. The exception is a query where the GROUPING SETS option is specified in a derived table or a view, and the SAMPLE clause is specified in the outer query.
How GROUPING SETS Summarizes Data
GROUPING SETS allows you to group your results set multiple times. Empty parentheses () specify a single grand total group that sums all the groups specified in the query.