I have the following setup in MySQL:
- Table
Game:gameid,p1state,p2state - Table
PlayerGamestate:playergamestateid,ready
p1state and p2state are foreign keys into PlayerGamestate. I want to return all Games which have BOTH p1state and p2state marked as ready=1. Is this possible in a single query?
I am using php to access if that matters but I would prefer to do it in one query.
Yes: