即使这已经在这里问过十亿次了,但是没有一次对我有用。 所以:我有两张桌子:
banhammer_bans:
和banhammer_players:
我应该使哪种查询从“player_id”和“creator_id”值对应的“players”表中获取名称值?我尝试过JOINS和UNIONS但没有成功。
答案 0 :(得分:2)
Select p.name, p.id as player_id, b.creator_id as creator_id
from banhammer_bans as b
inner join banhammer_players as p on p.id = b.player_id
答案 1 :(得分:1)
您可以使用以下内容:
select
*
from
banhammer_bans, banhammer_players
where
banhammer_players.player_id = banhammer_bans.id
这也是一种加入,但它存在某种效率问题。