查找的时候排序呀,ORDERY BY 排序字段 ASP/DESC 即可

解决方案 »

  1.   

    select * from 表名 order by 字段名称 desc 
    这个就是从字段的值最大就排到最前面,如果把desc改成asc就是从小排到大
      

  2.   

    "select * from 表名 order by 身价 desc ";
      

  3.   

    你是想实时的显示,对吧
    那也是查数据库,不过是在你点击的时候查
    select count(id) from yourTable where 身价>甲的身价取出来之后+1就可以了
      

  4.   

    或者直接
    select count(id)+ 1 from yourTable where 身价>甲的身价
      

  5.   

    你的意思是说当我查甲的时候,每次看甲的前面有几个人
    但是 where 身价>甲的身价
    我怎么知道甲的身价呢?是不是用一个嵌套sql语句,怎么写呢?
    还有,怎么显示count呢?(用label控件?)
    谢谢你了(闭关|那一剑的风情) 你解决了我不少问题!高手!
      

  6.   

    这样可以吗?
    select count(id)+ 1 from qiuyuan where shenjia>{select shenjia from qiuyuan where name=甲}
    我的SQL语法都 还给老师了
      

  7.   

    select count(id)+ 1 from qiuyuan where shenjia>(select shenjia from qiuyuan where name=甲)
    这个count怎么在程序中显示出来
      

  8.   

    select count(id)+ 1 from qiuyuan where shenjia>{select shenjia from qiuyuan where name=甲}------>select count(id)+ 1 from qiuyuan where shenjia>(select shenjia from qiuyuan where name=甲)把大括号改成小刮号
      

  9.   

    datagrid 里面也有排序方法 自己侃侃帮助
      

  10.   

    这个count怎么在程序中显示出来
    你要执行这个SQL
    得到返回值不就可以显示了吗
    这个跟你显示其他的是一样的
      

  11.   

    不用搞这么复杂新建一个视图,在里面设计一个比如
    select (计算身价的计算公司)as shenjia,[各字段] from 要查询的表 where 条件命名为view1
    以后查询的时候直接用这个shenjia字段就ok了,这个是自动生成的,而且执行效率比直接写sql语句要高