how to use the SQL Server ROLLUP to generate multiple grouping sets.
Similar to GROUPING SETS , you can use the ROLLUP option in a single query to generate multiple grouping sets. ROLLUP generates all grouping sets that make sense in this hierarchy.
The GROUP BY clause’s subclause, SQL Server ROLLUP, offers a shortcut for defining multiple grouping sets.
In contrast to the CUBE subclause, ROLLUP only makes a subset of all grouping sets based on the dimension columns.
ROLLUP only generates grouping sets based on the hierarchy it assumes exists between the dimension columns when generating the grouping sets.
For reporting purposes, the ROLLUP is frequently used to produce subtotals and totals.
