Running Total

  • I want to update a running total column. Can I do this?

    What I have:

    start_date.....end_date....date_diff....running_tot

    1/1/2004......1/2/2004..........1..............

    1/2/2004......1/3/2004..........1..............

    What I want:

    start_date.....end_date....date_diff....running_tot

    1/1/2004......1/2/2004..........1..............1

    1/2/2004......1/3/2004..........1..............2

  • how about a nested query?

    below demonstrates this type of query.

    using northwind as an example:

    SELECT X.ORDERID, FREIGHT, (SELECT SUM(FREIGHT) FROM ORDERS Y WHERE Y.ORDERID <= X.ORDERID) AS RUNNING_TOTAL

    FROM ORDERS X

    ORDER BY X.ORDERID

    hope that helps

    Billy

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

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