Sunday, April 12, 2015

Explain Lead/Lag with simple example

select RegionID,RegionDescription,
lag(RegionDescription,1,0) over(order by RegionID) proceding_row,
lead(RegionDescription,1,0) over(order by RegionID) following_row
from [dbo].[Region]

image

No comments:

Post a Comment