LAG

Computer Science

Accesses data from a previous row in the same result set without the use of a self-join starting with SQL Server 2012. LAG provides access to a row at a given physical offset that comes before the current row. Use this analytic function in a SELECT statement to compare values in the current row with values in a previous row.