出於某種原因,我不能簡單地介紹一些代碼。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「