我正在开发一个足球联盟,其中的队伍是由计算机随机完成的。 这个联盟排名球员而不是球队。 每位玩家根据游戏结果得分:
his team wins : player scores 3 point
his team wins >5 goals difference: player scores 4 points
his team draws: player scores 1 point
his team loses: player doesnt score
为了存储联盟数据,我在mySQL InnoDB中创建了这些表:
game (id)
player (num, name)
team (game.id, player.num, type)
goals (time, team.id, team.num, team.type)
type - 标识哪个团队是玩家(CHAR“A”或“B”)
答案 0 :(得分:0)
SUM(CASE WHEN a THEN 3
WHEN b THEN 4
WHEN c THEN 5
WHEN d THEN 1
ELSE 0 END) ttl