Runnig total

  • plz suggest how i can get running total +somecharacters in my select query but for reload it should not be repeated.

    Just like identity

    Thanx

  • Will something like this work for you.

    create table run(id int identity, num int)

    insert into run (num) values(10)

    insert into run (num) values(20)

    insert into run (num) values(30)

    insert into run (num) values(40)

    insert into run (num) values(50)

    select num, (select sum(num) from run where id <= a.id) "Running Total"

    from run a

    drop table run

    Gregory A. Larsen, DBA

    Contributor to 'The Best of SQLServerCentral.com 2002' book. Get a copy here: http:www.sqlservercentral.com/bestof/purchase.asp

    Need SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

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

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