Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 MySQL 中有以下设置:
Game
gameid
p1state
p2state
PlayerGamestate
playergamestateid
ready
p1state并且p2state是PlayerGamestate. 我想退回所有同时具有 BOTHp1state并p2state标记为ready=1. 这可能在单个查询中吗?
ready=1
如果这很重要,我正在使用 php 进行访问,但我更愿意在一个查询中进行访问。
是的:
SELECT GameID FROM Game G INNER JOIN PlayerGameState GS1 on G.P1state = GS1.PlayerGamestateID INNER JOIN PlayerGameState GS2 On G.P2State = GS2.PlayerGameStateID WHERE GS1.ready=1 and GS2.ready=1