我有四张桌子:
- 人物
- arena_team
- arena_table_member
- arena_team_stats。
字符表有 guid,名称
arena_team 表有 arenateamid, name, type
arena_table_member 表有 guid(这与字符表中的相同), arenateamid
arena_team_stats 表有 arenateamid、rating、wins、wins2、played
如何获取角色所在的竞技场团队列表?我试过:
$result=mysql_query("SELECT
characters.guid
, characters.name
, arena_team.arenateamid
, arena_team.name
, arena_team_stats.rating
, arena_team_stats.wins
, arena_team_stats.wins2
, arena_team_stats.played
, arena_team.type
FROM characters
, arena_team_stats
, arena_team
WHERE characters.name LIKE '%$q%'
AND arena_team.arenateamid = arena_team_stats.arenateamid
ORDER BY arena_team_stats.rating DESC")
or die(mysql_error());
但它会返回 arena_team 表中的所有竞技场团队。