Keepinga running total?

  • Hi

    Trying to keep a running total on below([View As]) field

    so instead of having

    program1

    program1

    program1

    program2

    program2

    I would like to have

    Program1 , 3

    Program2 , 2

    Hopefully I've explained this correctly

    Thanks

    Joe

    SELECT Programs.[View As]

    FROM Programs

    INNER JOIN ProgramSites ON Programs.ObjectID = ProgramSites.Program

    INNER JOIN ClientCases ON ProgramSites.ID = ClientCases.Program_Site

    WHERE (ClientCases.[Discharge Date] IS NULL)

    OR (ClientCases.[Discharge Date] IS NULL)

  • Wouldn't a simple COUNT with a GROUP do the trick for you?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Yes it would...:)

    Sorry, Rainy Monday morning...

    Thanks

  • jbalbo (6/15/2015)


    Yes it would...:)

    Sorry, Rainy Monday morning...

    Thanks

    Heh... not a problem and right there with you. I thought I might be missing something because I answered prior to my second cup of coffee. 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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