I am trying to put together a query that will find the value in the next row. Below is an example. Basically I have the start date of the term but I want the end date to be the start date of the next term
How data is stored:
IDTerm_StartTerm_End
13/FA2013-04-22 2013-08-18
14/SP2013-11-04 2013-12-20
My goal:
13/FA 2013-04-22 2013-11-04
14/SP2013-11-04 2014-4-01
I have been trying this approach and not sure if it will work.
;with a as
(
select Term_Id_Cd,
Registration_Start_Dt, Registration_End_Dt, row_number() over(order by term_start_dt) as rn
from term_c
)
Thanks