Need to update last form table.
Here's a relevant script:
select u.id,
u.screen_name,
max(case when rn=1 then points end) m1,
max(case when rn=2 then points end) m2,
max(case when rn=3 then points end) m3,
max(case when rn=4 then points end) m4,
max(case when rn=5 then points end) m5,
SUM(m.points) pts
from (select users.id id, screen_name from users, settings where users.setting_id = settings.id) u
join (
select
user_id,
points,
@rn:=IF(user_id=@prevUserId,@rn+1,1) rn,
@prevUserId:=user_id,
m_date
from
(select m.id match_id, guesses.id as g_id, points, user_id, date m_date
from guesses, (select * from matches where date < '2014-05-13 13:17' order by date DESC limit 5) m
where guesses.match_id = m.id order by m.date) t
join (select @prevUserId:= 0, @rn:= 0) g
order by user_id, m_date desc
) m on u.id = m.user_id
group by u.id, u.screen_name
order by pts DESC, m1 DESC, m2 DESC, m3 DESC, m4 DESC, m5 DESC