SQL Server 2012

Technical Article

Lead and Lag Functions in SQL Server 2012

  • Article

Arshad Ali discusses how to use CTE and the ranking function to access or query data from previous or subsequent rows. He also shows you how to leverage the LEAD and LAG analytics functions to achieve the same result without writing a self-join query using CTE and ranking function

★ ★ ★ ★ ★ ★ ★ ★ ★ ★

You rated this post out of 5. Change rating

2014-12-10

8,382 reads

Blogs

DiskANN Experiment — Exploring Entry Points and Graph Neighborhoods

By

Introduction I was experimenting with vector search in SQL Server 2025 using approximately 3.8...

T-SQL Tuesday #203: Risk and Reward

By

This is timely, as I’m currently on a boat in the Adriatic taking a...

dataMinds Connect 2026 – Slides & Scripts

By

You can find the slides and SQL scripts for my session “Spice up your...

Read the latest Blogs

Forums

Alamat Telp BCA KCP Cengkeh +62 838-4945-0961

By Layanan_BCA_24jam

Wa:083849450961 Jl. Cengkeh 21-21A, RT.7/RW.7, Pinangsia, Kec. Taman Sari, Kota Jakarta Barat, Daerah Khusus...

Training the next generation

By Pat Wright

Comments posted to this topic are about the item Training the next generation

Reusing Customer Specific Order Filtering Logic with CROSS APPLY and an Inline TVF (Part 4)

By Imran2629

Comments posted to this topic are about the item Reusing Customer Specific Order Filtering...

Visit the forum

Question of the Day

PostgreSQL psql Meta Commands: Databases

Which of the following meta commands (sometimes called backslash or slash commands) within psql will provide you with information about the databases on the cluster?

See possible answers