Beginning of a field in the layout file

  • 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

  • I will re-post on the right forum

    Neber mind

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply