I have a race database that contains a table with a field for a lap time and another for the track where the lap was run, and a driver_id field for the driver. I'm trying to use a query to pull the fastest lap time for each track. I can get the info like this :
select min(qualifytime),Track
from points
group by Track
but i also need to see the driver who ran the lap.
If I add the driver_id to the query, I also have to add it to the group by and I get every drivers time, not just the driver with the fastest lap at each track.
I tried a where clause with a subquery like
where qualifytime = (select min(qualifytime) from points)
but that doesn't give a min time for each track.
Any help appreciated
select min(qualifytime),Track
from points
group by Track
but i also need to see the driver who ran the lap.
If I add the driver_id to the query, I also have to add it to the group by and I get every drivers time, not just the driver with the fastest lap at each track.
I tried a where clause with a subquery like
where qualifytime = (select min(qualifytime) from points)
but that doesn't give a min time for each track.
Any help appreciated