GROUPING_ID
grouping level id
What changes
- Input
- GROUP BY columns
- Output or change
- bitmask of rolled-up columns
- Return type
- int
Syntax at a glance
GROUPING_ID ( <column_expression> [ , ...n ] )
Work example
Identify which grouping columns were rolled up in a subtotal row.
Pass grouping expressions in the same intended order and map the bitmask to readable labels.
Check your work GROUPING_ID is a grouping bitmask, not a row identifier.
Open Microsoft Learn for full syntax, permissions, and details for your version.