I'm having trouble trying to retrieve data from mySQL table. The table holds all the lap times from a racing event by all the participants. The table has multiple entries for each race. I would like to select each participant's best lap time, however I'm not sure how to get rid each participant's duplicates.
I've tried the following statement.
SELECT *
FROM laptimes
GROUP BY laptime,
username
The table looks like this:
lap username laptime
2 Blackvault 1200.000
1 Blackvault 1234.000
3 Elmo 1235.000
I'd like to display only lap 2 of Blackvault and Elmo's only lap. The SQL will need to be generic as there could be N number of racers and N number laps.
Any help is appreciated.