--创建测试数据
create table tbTemp(userid int primary key, Score int);
insert tbTemp(userid, Score)
select 1, 63 union all
select 2, 63 union all
select 3, 78 union all
select 4, 89 union all
select 5, 95 union all
select 6, 95;
--查询成绩排名
SELECT *,RANK() OVER(ORDER BY SCORE DESC) as ScoreOrder
FROM tbTemp
--删除测试数据
drop table tbTemp;
/*******************
查询结果:
5 300 1
6 300 1
3 200 3
4 200 3
1 100 5
2 100 5
*******************/