我有三张桌子:
players
------
id|name
teams
-------
id|name
teams_players
-------------
id|teamID|playerID
我现在想从表“players”中获取每个条目,其中 player.id 例如在 id 为 15 的团队中。换句话说:我想获取属于特定团队的每个玩家(例如 teamID=15)
我尝试加入但失败了。
这是我到目前为止得到的:
"SELECT players.*
FROM players
JOIN teams_players
ON teams_players.teamID = 15
GROUP BY players.id";