How do you write
SELECT team, SUM(goals) FROM gameResults GROUP BY team
where gameResults also has a date field and you only want to sum the last 3 games?
gameResults is a table with
Putting LIMIT at the end isn't quite right - what's needed is a sort of LIMIT within the SUM() funtion.
It seems like it should be simple to 'sum the goals from the last 3 games' but even doing it in php code is tending towards loopy fiddelyness.
Any help much appreciated.