SQL SEVER中有一表: 
          
          姓名   分数
          王五    70
          张三    90
          赵六    60
          李四    80现在想在VB 的DATA GRIDE控件中表示出来,并添上“排名”,如:
   
    排名   姓名  分数
    1     张三  90
    2     李四  80
    3     王五  70
    4     赵六  60请问如何解决?
谢谢

解决方案 »

  1.   

    select * by order 分数
      

  2.   

    strsql="select 姓名,分數 from tablename order by 分數 desc"
    Set rs = conn.Execute(strsql)
    Set DataGrid1.DataSource = rs
      

  3.   

    select a.姓名,a.分数,(select count(*) from tablename b where a.分数>b.分数)+1 as 排名 
    from tablename a order by a.分数
    这样,如果分数一样,名次是一样的.
      

  4.   

    .....order by 分數 [desc]要不倒序  要不就正序 自己式吧 欧忘了