一个表 有3个column  
class_no(班级)
student_no(学号)
score(成绩)统计出来结果:class_no(班级)
student_no(学号)
score_level 成绩排名怎么写?

解决方案 »

  1.   

    参考下贴中的多种实现方法。
    http://blog.csdn.net/ACMAIN_CHM/archive/2009/04/20/4095531.aspx
      

  2.   


    你再看一便,class_no(班级)
    student_no(学号)
    score_level 成绩排名相当于分组再排序
      

  3.   


    class  student_no scorre
      5       N11       76   
      3       N27       78   
      5       N13       90   
      5       N19       82   
      3       N22       65    class  student_no score_level(本班级排名)
      5       N13       1   
      5       N19       2   
      5       N11       3   
      3       N27       1   
      3       N22       2    
      

  4.   

    select class,student_no,(select count(*)+1 from 一个表 where class=a.class and scorre>a.scorre) as score_level
    from 一个表 a
    order by 1,3