I have a table with user_id
and lap_time
and I'm running the following query:
SELECT `Lap`.`id`, `Lap`.`user_id`, `Lap`.`lap_time`
FROM `laps` AS `Lap`
WHERE `Lap`.`lap_time` < 57370
GROUP BY `Lap`.`user_id`
ORDER BY `Lap`.`lap_time` ASC
I am trying to get the all the laps that are quicker than X but only unique users.
The query above doesn't return the users top lap, its like I need to order the GROUP BY
if that makes sense?
Users can have many laps, so there could be 10 laps faster than X but they're all by same user, so I just want the top lap for that user.
Hope that makes sense and someone can help!