Reference Guide > TDV Support for SQL Functions > TDV-Supported Analytical Functions > LAG
 
LAG
LAG provides access to more than one row of a table at the same time without a self-join. Given a series of rows returned from a query and a position of the cursor, LAG provides access to a row at a given physical offset prior to that position.
Syntax
LAG (expression [, offset_expression [, default_expression ] ] ) [IGNORE NULLS] OVER ([ PARTITION BY expression [, ...] ]
ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } [, ...] )
Remarks
IGNORE NULLS is optional.
PARTITION BY is optional.
ORDER BY is required.
The window clause is not allowed.