0178.sql (138B)
1 SELECT S.Score, count(DISTINCT t.score) AS 'rank' 2 FROM Scores S 3 JOIN Scores T 4 ON S.Score <= T.score 5 GROUP BY S.Id 6 ORDER BY S.Score DESC