Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime
Indicates whether a specified column in a GROUPING SET, ROLLUP, or CUBE represents a subtotal.
Syntax
grouping(col)
Arguments
col: A column reference identified in aGROUPING SET,ROLLUP, orCUBE.
Returns
An INTEGER.
The result is 1 for a specified row if the row represents a subtotal over the grouping of col, or 0 if it is not.
Examples
> SELECT name, grouping(name), sum(age) FROM VALUES (2, 'Alice'), (5, 'Bob') people(age, name) GROUP BY cube(name);
Alice 0 2
Bob 0 5
NULL 1 7