• jcrawf02 (6/27/2008)


    Sergiy (6/27/2008)


    jcrawf02,

    can you explain this:

    ISNULL(count(distinct #PLANDATA_Claim.claimid),0) AS "FFS",

    What ISNULL is doing here?

    I have three environments that I need to query to find my data. #files table is in one, #PLANDATA is another, #ENCOUNTER is the third.

    I am counting distinct claimids from #PLANDATA (user knows it as FFS) or #ENCOUNTER (user knows it as Encounter) and returning that value within the same row of the result set.

    I'm basically changing the total to 0 for this column in the result set in the case that there aren't any claimids, so that it won't be null.

    Nah... "Must look eye!"... Sergiy doesn't need to know about all of that... he's trying to get you to go look back at your code to see why you don't need ISNULL.

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