16.20 - Multiple Window Specifications - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

In an SQL statement using more than one window function, each window function can have a unique window specification.

For example,

   SELECT StoreID, SMonth, ProdID, Sales,
   AVG(Sales) OVER (PARTITION BY StoreID 
                    ORDER BY SMonth
                    ROWS BETWEEN 2 PRECEDING AND CURRENT ROW),
   RANK() OVER (PARTITION BY StoreID ORDER BY Sales DESC)
   FROM sales_tbl;