0
昨天我開始更新我的記分牌有一些新的colomns工作,並得到了一些好的建議這裏,所以可能我會如此大膽地問了另一個問題?總和(情況計算總歐元每名球員
簡單的SQL這裏,但我需要的案例()爲歐元summorized所以它表明獲得總歐元或失去了所有回合
SELECT t1.playerid, sum(t1.points) as totalpoints, count(t1.playerid) as rounds,avg(points) as avgpoints
,Case
when count(t1.playerid) in(7,6) and (select points from pokermax_scores as t4 where t1.playerid=t4.playerid and t1.tournamentid=t4.tournamentid) = 38 then 15
when count(t1.playerid) in(7,6,5) and (select points from pokermax_scores as t4 where t1.playerid=t4.playerid and t1.tournamentid=t4.tournamentid) = 25 then 5
when count(t1.playerid) in(5,4) and (select points from pokermax_scores as t4 where t1.playerid=t4.playerid and t1.tournamentid=t4.tournamentid) = 38 then 10
when count(t1.playerid) = 7 and (select points from pokermax_scores as t4 where t1.playerid=t4.playerid and t1.tournamentid=t4.tournamentid) = 16 then 0
when count(t1.playerid) = 4 and (select points from pokermax_scores as t4 where t1.playerid=t4.playerid and t1.tournamentid=t4.tournamentid) = 25 then 0
else -5
End as Euro
FROM pokermax_scores as t1
group by t1.playerid
order by avgpoints desc
回報: IMG 「http://i62.tinypic.com/213iud0.png」
你可以看到歐元不summorized只是隨機的人..
清理問題,所以它更容易理解的問題。 – Jorn