出于某种原因,我不能简单地介绍一些代码。MySql为体育联盟的.pct划分
我想在下面的代码中将“赢”分为“玩”,这样在我的输出中,如果您赢得了4场比赛中的2场比赛,则显示为.500?
确定它很简单,放置可能是关键,但我无法为我的生活摸索它!
$result = mysql_query("
select team,
count(*) played,
count(case when HomeScore > AwayScore then 1 end) wins,
count(case when AwayScore > HomeScore then 1 end) lost,
count(case when HomeScore = AwayScore then 1 end) draws,
sum(HomeScore) ptsfor,
sum(AwayScore) ptsagainst,
sum(HomeScore) - sum(AwayScore) goal_diff,
sum(case when HomeScore > AwayScore then 3 else 0 end + case
when HomeScore = AwayScore then 1 else 0 end) score
from (select
HomeTeam team,
HomeScore,
AwayScore
from Game
union all
select AwayTeam,
AwayScore,
HomeScore
from Game) a
group by team
order by wins desc,
draws desc,
lost asc,
goal_diff desc;");
感谢
我现在得到“警告:mysql_fetch_assoc()预计参数1是资源,布尔在/home/peterborough/www/www/leaguetable.php给出的41行”,这是我的,而语句,其工作先前:while($ row = mysql_fetch_assoc($ result)) { echo“