Analytic Function — Lag

Starting with SQL Server 2012, Microsoft has included analytic functions within the database.  A couple that I use often, Lag and Lead, are very handy when you need to reference a previous or next row in a table without having to use self-joins or having to create a complicated sql statement.

Continue reading Analytic Function — Lag