0
我之前问过关于从足球结果列表中动态创建表格的问题,后来我忘记添加和实现的是缺少一些东西,基本上我想在输出表中包含一个俱乐部徽章。我该如何改变这个mysql查询以包含另一个mysql表?
这是对浏览器输出
$sqlCommand = "
select team,
count(*) played,
count(case when goalsfor > goalsagainst then 1 end) wins,
count(case when goalsagainst> goalsfor then 1 end) lost,
count(case when goalsfor = goalsagainst then 1 end) draws,
sum(goalsfor) goalsfor,
sum(goalsagainst) goalsagainst,
sum(goalsfor) - sum(goalsagainst) goal_diff,
sum(case when goalsfor > goalsagainst then 3 else 0 end
+ case when goalsfor = goalsagainst then 1 else 0 end)score
from (select hometeam team, homebadge badge, goalsfor, goalsagainst from serie_a_2010_2011
union all
select awayteam, awaybadge, goalsagainst, goalsfor from serie_a_2010_2011) a
group by team
order by score desc, goal_diff desc";
我已经创建了我的数据库中的另一个表称为徽章结构如下
----------------------------------------------
| id | team | badge |
----------------------------------------------
| 1 | Inter | (link to image of Inter badge)|
----------------------------------------------
| 2 | Milan | (link to image of Milan badge)|
----------------------------------------------
etc etc
这包括即时创建表的代码所有将在排名表输出的球队
我将如何创建/添加/加入/额外的查询,将输出正确的徽章为右te上午?
它似乎并没有工作,保持关于表和列的错误不存在....表格那里是列.... –