• Skanda (10/17/2012)


    CROSS APPLY (

    SELECT col = CASE WHEN MAX(col) = MIN(col) THEN MAX(col) ELSE NULL END

    )

    You REALLY need to get out of the habit of editing your posts. Replacing the question with the answer does no one reading the thread any good. Even you won't have a clue as to what the question actually was in a couple of weeks so you've destroyed your own valuable reference.

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