Running Sum

  • Problem solved with cursors

    Edited by - botond.baika on 05/21/2003 07:40:42 AM


    🙂

  • SELECT

    Identity(BigInt, 1, 1) As Counter,

    '1' codes, [Values], 0 as RunningSum

    INTO #Tmp

    FROM ExTbl

    declare @x int

    select top 1 @x = [values] from #Tmp

    Update #Tmp

    SET RunningSum = @x,

    @x = @x + [Values]

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

  • Thank you! :))

    Your's is faster and much more simple. 🙂

    Probably that's why I didn't manage to figure out myself... it was too simple! 🙂

    Thanx again for your time!

    Best regards,

    Botond

    Edited by - botond.baika on 05/23/2003 03:22:23 AM


    🙂

  • pls reply me

Viewing 4 posts - 1 through 3 (of 3 total)

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