带orderBy顺序查询?

解决方案 »

  1.   

    ???不是很明白意思您是要查出表中数据所在的位置呢?还是想知道order by以后的数据?
      

  2.   

    --LZ的意思有点模糊!
    --设存在一表,且有自增列,但自增列不一定连接,求表中第3条记录
    --答:
     Declare @t Table(Id Int,Names Varchar(10))
     Insert @t Select 1,'a'
     Union all Select 2,'b'
     Union all Select 3,'c'
     --
     Select Top 1 * 
     From (Select Top 3 * From @t) A   --3为在表中的位置
     Order by 1 Desc
      

  3.   

    select identity(int,1,1) I,字段 into #tmp from 表名
    select * from 表名 where I=位置
      

  4.   

    Select Top 1 * 
    From table where id not in(Select Top 你所要的位置数 * From table) Order by id
      

  5.   

    楼主的意思是说要select出一个表的第x行的纪录吧
    这个你可以在把此表插入一个有自增列的临时表中或给此表建一个自增列
    这样就可以select * from table1 where id=x
    不知道理解对楼主的意思没有