GROUPING SETS Option | SQL SELECT Statements | Teradata Vantage - GROUPING SETS Option - 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
ft:locale
en-US
ft:lastEdition
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢
Analyzes data in one of two possible ways:
  • In a single dimension without performing a full ROLLUP.
  • In multiple dimensions without performing a full CUBE.

ANSI Compliance

GROUPING SETS is ANSI SQL:2011 compliant.

SAMPLE Clause and GROUPING SETS

You cannot specify a SAMPLE clause in a query that also specifies the GROUPING SETS option in a GROUP BY clause. The exception is a query where the GROUPING SETS option is specified in a derived table or a view, and the SAMPLE clause is specified in the outer query.

How GROUPING SETS Summarizes Data

GROUPING SETS allows you to group your results set multiple times. Empty parentheses () specify a single grand total group that sums all the groups specified in the query.