nPath Function LAG Expression Syntax | Teradata Vantage - LAG Expression Syntax - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-02-17
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
{ current_expr operator LAG (previous_expr, lag_rows [, default]) |
  LAG (previous_expr, lag_rows [, default]) operator current_expr }

where:

  • current_expr is the name of a column from the current row (or an expression operating on this column).
  • operator is either >, >=, <, <=, =, or <>
  • previous_expr is the name of a column from a previous row (or an expression operating on this column).
  • lag_rows is the number of rows to count backward from the current row to reach the previous row. For example, if lag_rows is 1, the previous row is the immediately preceding row.
  • default is the value to use for previous_expr when there is no previous row (that is, when the current row is the first row or there is no row that is lag_rows before the current row).