• As I recall, 2005 doesn't support windowed functions, so you have to deal with any running totals problem (decrementing from a total falls under the category of running totals) in one of two ways: Either use a loop or a cursor to do row by row decrements, or use the infamous quirky update method.

    Read this to get you started:

    http://www.sqlservercentral.com/articles/T-SQL/68467/[/url]

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills