Running total RRS feed

  • Question

  • I have a two column table as follows. Col1 is a datetime column (only with date though, time is all zeros). col2 is count.

    date            count
    01/01/09      25
    02/03/09      50
    12/08/09     4000

    i want to find the date and count in the following format. The date on which the sum(count) reached 5000, date on which sum(count) reached 10000, date which sum(count) reached 15000 etc) 
    date          sum(count)
    12/10/09    5000
    01/01/10    10000

    any help is appreciated
    Tuesday, January 5, 2010 8:26 PM


  • It works the same in SQL Server 2005.
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    • Marked as answer by RookieDBA Tuesday, January 5, 2010 8:56 PM
    Tuesday, January 5, 2010 8:50 PM

All replies