17.05 - Example: SELECT Statement With a Scalar Subquery in Its GROUP BY Clause - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
vnq1596660420420.ditamap
dita:ditavalPath
hoy1596145193032.ditaval

The following example specifies a scalar subquery in its GROUP BY clause:

     SELECT sale_date, SUM(amount)
     FROM sales_table AS s
     GROUP BY sale_date, (SELECT prod_name 
                          FROM prod_table AS p
                          WHERE p.prod_no = s.prod_no);