Taħriġ
Modulu
Use built-in functions and GROUP BY in Transact-SQL - Training
Use built-in functions and GROUP BY in Transact-SQL
Dan il-brawżer m'għadux appoġġjat.
Aġġorna għal Microsoft Edge biex tieħu vantaġġ mill-aħħar karatteristiċi, aġġornamenti tas-sigurtà, u appoġġ tekniku.
Nota
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tidħol jew tibdel id-direttorji.
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tibdel id-direttorji.
grouping
functionApplies to: Databricks SQL
Databricks Runtime
Indicates whether a specified column in a GROUPING SET
, ROLLUP
, or CUBE
represents a subtotal.
grouping(col)
col
: A column reference identified in a GROUPING SET
, ROLLUP
, or CUBE
.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.
> 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
Taħriġ
Modulu
Use built-in functions and GROUP BY in Transact-SQL - Training
Use built-in functions and GROUP BY in Transact-SQL