• montecarlo2079 (2/22/2013)


    The table has 4 columns

    ICN, From Date of service, To date of service, and detail status code

    123,1/1/12 ,1/5/12 ,P

    123,1/6/12 ,1/6/12 ,p

    123,1/1/12 ,1/10/12 ,p

    For each ICn I need to count only the distinct days per icn. in this example above, the answer would be 10. I dont want to count each day, but want the count of distinct days per ICN.

    does that help?

    Not really. We don't know what the datatyes are, etc.

    --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)