SOLVED: Getting the two best results
Posted: Mon Sep 03, 2007 5:29 pm
Hi 
I have a table `results` cca like this:
(That means there are many races, each consists of a few stages and the final time of the race is the sum of all stages times)
I may get the final times with
Now, I need to get the two fastest times from the season for every player. Is there some easy way to do that via MySQL?
Thanks in advance
I have a table `results` cca like this:
Code: Select all
player_id race_id stage_id time
1 1 1 5
1 1 2 3
1 2 1 4
1 2 2 6
1 2 3 2
1 3 1 7
1 3 2 2
2 1 1 2
2 1 2 3
2 2 1 7
2 2 2 2
2 2 3 7
2 3 1 5
2 3 2 4
...I may get the final times with
Code: Select all
SELECT *, SUM(time) as time_final,
FROM results
WHERE race_id = '$id'
GROUP BY player_id, race_id
Thanks in advance