你先用select * from table order by desc然后取recno.

解决方案 »

  1.   

    to  icevi(按钮工厂): 对不起,打错了。是查找某一位同学的排名。to  My_first(海浪) ,谢谢,在SQL中如何取某一ID的recno?
      

  2.   

    select 1+isnull(select count(*) from tablename where 成绩>a.成绩),0) as 排名,* from tablename a
    ...
    ...可以替换某一位的排名: 
    ...替换为
    where 学号='00001'全班:
    ...替换为
      

  3.   

    1,建序数表
    select top 8000 identity(int,1,1) as N into Nums from 
    (select top 100 id=1  from sysobjects) as a,
    (select top 100 id=1  from sysobjects) as b,
    (select top 100 id=1  from sysobjects) as c
    2,
    select Nums.n as 名次,a.姓名 from 成绩表 a left join Nums on 
    (select count(*)+1 from 成绩表 aa where aa.成绩<a.成绩表)=Nums.n