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

Is a column_expression 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