GROUPING_ID

Is a function that computes the level of grouping. GROUPING_ID can be used only in the SELECT <select> list, HAVING, or ORDER BY clauses when GROUP BY is specified.

Syntax

GROUPING_ID ( <column_expression>[ ,...n ] )

Arguments

column_expression

Is a column or an expression that contains a column in a GROUP BY clause.

Return types

int

Examples

SELECT GROUPING_ID([FloatValue],[IntValue]) AS [GroupingId]
  FROM [BasicDataTable]
 GROUP BY CUBE([FloatValue],[IntValue])

See Also