- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
SELECT z.id, z.user_id, z.points_figure, MAX( z.date_practice )
FROM (
SELECT p . * , h.date_practice
FROM practice_update p
INNER JOIN practice_update_history h ON p.history_id = h.id
WHERE p.is_confirmed = 1 OR p.is_updated = 1
order by h.date_practice desc
) z
GROUP BY 2