0
我有三個表:MySQL查詢聯接三個表
players
------
id|name
teams
-------
id|name
teams_players
-------------
id|teamID|playerID
我現在想從表「玩家」,其中players.id例如在球隊ID爲15.換句話說每個條目:我想讓每個屬於特定球隊的球員(例如teamID = 15)
我嘗試了一個加入但是失敗了。
這是我走到這一步:
"SELECT players.*
FROM players
JOIN teams_players
ON teams_players.teamID = 15
GROUP BY players.id";
OMG這麼簡單!謝謝 :) –