GROUP BY Clause Syntax | Teradata Vantage - GROUP BY Clause Syntax - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢

Syntax Elements

GROUP BY group_by_spec [,...]
group_by_spec
{ ordinary_grouping_set |
  empty_grouping_set |
  rollup_list |
  cube_list |
  grouping_sets_specification
}
ordinary_grouping_set
Column expression by which the rows returned by the statement are grouped.
You cannot specify BLOB, CLOB, Period, ARRAY, VARRAY, XML, or JSON columns in the grouping expression.
ordinary_grouping_set can include:
  • column_name
  • column_position
  • column_expression
For the definitions of these expressions, see Ordinary Grouping Set Expressions.
empty_grouping_set
Contiguous LEFT PARENTHESIS, RIGHT PARENTHESIS pair without an argument. You use this syntax to request a grand total, that is, a summation of all the individual group totals, not a summation of the nonaggregate data.
The term grand total refers to .
rollup_list
ROLLUP expression that reports result rows in a single dimension with one or more levels of detail. For more information, see ROLLUP Option.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
cube_list
A CUBE expression that reports result rows in multiple dimensions with one or more levels of detail. For more information, see CUBE Option.
The expression cannot group result rows that have a BLOB, CLOB, ARRAY, or VARRAY type.
grouping_sets_specification
A GROUPING SETS expression that reports result rows in one of two ways:
  • As a single dimension, but without a full ROLLUP.
  • As multiple dimensions, but without a full CUBE.
For more information, see GROUPING SETS Option.