SELECT *
FROM banhammer_bans
INNER JOIN banhammer_players AS player
ON banhammer_bans.player_id = player.id
INNER JOIN banhammer_players AS admin
ON banhammer_bans.creator_id = admin.id
ORDER BY created_at DESC
單獨列名後,我得到三個id
列,並從banhammer_players表中的兩列name
。我如何分開這些,以便我可以在我的PHP代碼中使用它們?SQL:兩個內連接
banhammer_players包含兩列,id
和name
。 banhammer_bans有兩列(player_id
和creator_id
),它們都與banhammer_players表相匹配。
在SELECT語句中閱讀關於別名和使用表名稱 –