C
cinnie
Greetings to all - I have written SQL to rank athlete's scores. My query
works, but not quite the way I'd like.
Here is a simplified version of my tblAthScores:
AthID AthScore
102 23.6
103 19.5
123 21.9
177 22.4
179 21.9
215 18.4
My SQL is:
SELECT tblAthScores.AthID, tblAthScores.AthScore,
(SELECT Count(*)
FROM tblAthScores AS Copy
WHERE Copy.AthScore >= tblAthScores.AthScore) AS AthRank
FROM tblAthScores
ORDER BY tblAthScores.AthScore DESC;
The query produces:
AthID AthScore AthRank
102 23.6 1
177 22.4 2
179 21.9 4
123 21.9 4
103 19.5 5
215 18.4 6
Here (finally!) is my question. I'd like to know how to
a) get AthRank to show 1, 2, 3, 3, 5, 6
b) get AthRank to show 1, 2, 3, 3, 4, 5
Thanks in advance for any help. I'm really stuck.
works, but not quite the way I'd like.
Here is a simplified version of my tblAthScores:
AthID AthScore
102 23.6
103 19.5
123 21.9
177 22.4
179 21.9
215 18.4
My SQL is:
SELECT tblAthScores.AthID, tblAthScores.AthScore,
(SELECT Count(*)
FROM tblAthScores AS Copy
WHERE Copy.AthScore >= tblAthScores.AthScore) AS AthRank
FROM tblAthScores
ORDER BY tblAthScores.AthScore DESC;
The query produces:
AthID AthScore AthRank
102 23.6 1
177 22.4 2
179 21.9 4
123 21.9 4
103 19.5 5
215 18.4 6
Here (finally!) is my question. I'd like to know how to
a) get AthRank to show 1, 2, 3, 3, 5, 6
b) get AthRank to show 1, 2, 3, 3, 4, 5
Thanks in advance for any help. I'm really stuck.