思路:
即无间隔排名。对于每个数字比较分数中有多少个大于等于自己的数,即为自身排名。
代码:
select Score,
(select count(distinct Score) from Scores as s2 where s2.Score >= s1.Score) as Rank
from Scores as s1
order by Score DESC;
思路:
即无间隔排名。对于每个数字比较分数中有多少个大于等于自己的数,即为自身排名。
代码:
select Score,
(select count(distinct Score) from Scores as s2 where s2.Score >= s1.Score) as Rank
from Scores as s1
order by Score DESC;