MSSQL윈도우 함수LEAD
LAG

LEAD윈도우 함수

FIRST_VALUE

현재 행에서 n행 이후 값을 반환합니다.

문법

LEAD(expr [, n [, default]]) OVER (w)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

order_month
revenue
next_revenue
monthly_sales
SELECT order_month, revenue,
       LEAD(revenue, 1) OVER (ORDER BY order_month) AS next_revenue
FROM monthly_sales;