Please help!
Here is a table with simple values
create table #LAYOUT
(
id int identity primary key,
start int,
[length] int
)
insert into #LAYOUT (start, [length]) values(1, 10)
insert into #LAYOUT ([length]) values(1 )
insert into #LAYOUT ([length]) values(9)
insert into #LAYOUT ([length]) values(12)
insert into #LAYOUT ([length]) values(3)
insert into #LAYOUT ([length]) values(4)
select * from #layout
drop table #LAYOUT
I need to calculate values of a start column meaning that start equals to sum of the values of the start and the length columns of the previous record
In this case the result set should look like this
start length
-----------
1 10
11 1
12 9
21 12
33 3
36 4
This needs to be done by one query.
Thanks