LAG
Allows each record to access a record from the prior record. The specified record is passed into the LAG method. On the first record this value will be NULL, since there are no proceeding records.
SELECT
ColName1,
ColName2,
ColName3,
LAG(ColName1) OVER (PARTITION BY ColName1 ORDER BY ColName1, ColName2) AS Lag
FROM SchemaName.TableName
ORDER BY ColName1, ColName2Note: using PARTITION BY ColName1 is optional