GROUP BY ... WITH CUBE / WITH ROLLUP
non-ISO WITH CUBE / WITH ROLLUP suffix
What changes
- Input
- grouped rows
- Output or change
- detail plus super-aggregate rows
Syntax at a glance
GROUP BY column_expression [ ,...n ] WITH { CUBE | ROLLUP }
Work example
A legacy query uses the older CUBE or ROLLUP suffix after its grouping list.
Compare its output with the standard GROUP BY CUBE or ROLLUP form and label subtotal rows.
Check your work GROUP BY ... WITH CUBE / WITH ROLLUP. The standard form returns the same required grouping levels without relying on the legacy suffix.
Open Microsoft Learn for full syntax, permissions, and details for your version.