Hi team,
I want to get previous value for each ID without using CTE. below is my requiement
Declare @table table ( ID int, Value int ) Insert into @table Select 1,3 union all Select 1,4 Union all Select 2,4 Union all Select 2,5 Union all Select 2,6 Union All select 3,5 --input Select *from @table --expected output Select 1 ID,3 Value,null PrevValue Union all Select 1,4,3 Union all Select 2,4,null Union all Select 2,5,4 Union all Select 2,6,5 Union all Select 3,5,null
Thanks in advance,
-Eshwar
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.