0

即使这已经在这里被问了十亿次,但没有一个对我有用。所以:我有两张桌子:

banhammer_bans: banhammer_bans

和banhammer_players: banhammer_players

我应该进行什么样的查询才能从与“player_id”和“creator_id”值对应的“players”表中获取名称值?我试过 JOINS 和 UNIONS 但没有成功。

4

2 回答 2

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
于 2013-03-20T17:11:16.313 回答
1

你可以使用这样的东西:

select 
     * 
from 
     banhammer_bans, banhammer_players
where
     banhammer_players.player_id = banhammer_bans.id

这也是一种Join,但它有一些效率问题。

于 2013-03-20T17:08:56.073 回答