• Joel Ewald (3/24/2016)


    I think with the current data model and lack of constraints you would actually want both.

    WHERE Played = 'Rock' OR Played = 'Paper' OR Played = 'Scissors'

    GROUP BY Person HAVING COUNT(DISTINCT Played) = 3

    but the group by is key to the solution.

    Heh... my next point was going to be that if "Played" were not constrained in some fashion, there would be no guarantee that only Rock, Paper, or Scissors would be present and the GROUP BY could return an incorrect condition. I think that's even more important than how to possibly solve the stated problem and, in real life, would consider it to be a missing requirement.

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