表:
statistics (columns: id, wins, draws, losses, round1, round2, round3)
matches (columns: id, home_id,away_id,home1, away1, home2, away2, home3, away3)
我想获得每场比赛的平均得分。基本上它是: 总得分/比赛
我可以获得总分: ROUND1 + round2 + round3
总共玩游戏:
COUNT(id) FROM matches
如何获得我想要的结果?
SELECT
COUNT(matches.id) AS totalgames,
SUM(statistics.round1+round2+round3/COUNT(matches.id))
FROM matches, statistics
这显然不起作用......