I'm making a game where the score for the player is calculated hourly. The score is needed so the leader board can show the best ranked players. 'points' won in a game are stored for the player in the boards_played table. The players table has a score field which is updated hourly with this SQL:
update players p
inner join (
SELECT player_id, sum(points) as total
from boards_played
where time_played > DATE_SUB(now(), INTERVAL 7 DAY)
GROUP BY player_id) s on p.player_id = s.player_id
set p.score = s.total
The problem is somebody who wins a total of 50 points from 100 games should be a better rank than someone who wins 60 points from 200 games.
In short the score should only be based on the your last 100 games in the last 7 days.