Excel精英培训网

 找回密码
 注册

SQL写的排名语句

热度 3已有 1155 次阅读2013-10-19 16:22 |个人分类:SQL| 成绩

select 学生,成绩,
        (select count(成绩) from [排名$] a2 
            where a1.成绩<a2.成绩)+1 as 西式排名,
        (select count(成绩) 
            from(select distinct 成绩 from [排名$]) a2 
            where a1.成绩<=a2.成绩) as 中式排名
from [排名$] a1
order by 成绩 desc

刚表态过的朋友 (0 人)

发表评论 评论 (1 个评论)

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-3-28 23:41 , Processed in 0.660021 second(s), 8 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部