Blog Archive for April 26, 2016

Oracle LAG Function

April 26, 2016

I wanted to refer to the previous row in a query and to do some maths to see the difference in the current row's date from the previous row's date.

This can be done with the Oracle LAG function:

SELECT sch_header, sch_date, sch_number, sch_date - lag( …