I'm using the following query to list best times in a race. This works perfectly well but someone does the best record twice (for example, they finished the race in 15 seconds twice) they being listed twice. I don't want them to be listed again.
SELECT * FROM racerecords WHERE (holder_regid, rec_time) IN ( SELECT holder_regid, MIN(rec_time) FROM racerecords WHERE race_id = 17 GROUP BY holder_regid ) AND race_id = 17 ORDER BY rec_time;
Additional Info: holder_regid is the registration ID of the racer and the rec_time is the record time.
So how can I achive this? I tried to use
DISTINCT but I got error. Help me with the query.