2012-06-04 37 views
0

如何限制從每個俱樂部獲得的比賽數量,我想每個俱樂部只有10場比賽。 這是我在這裏找到how to output a standings table on the fly from a mysql table of football [soccer] results?如何設置遊戲桌面的遊戲限制從MySQL表中獲取足球結果?

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, goalsfor, goalsagainst from scores 
union all 
select awayteam, goalsagainst, goalsfor from scores 
) a 
group by team 
order by score desc, goal_diff desc; 
+0

*您想要爲每個俱樂部採取哪十種遊戲? – eggyal

+0

最近十次進行此查詢顯示來自所有俱樂部的所有比賽我只想顯示來自各個俱樂部的最後10場比賽 – user1432760

+0

如何知道比賽什麼時候進行? – eggyal

回答