如题 谢谢

解决方案 »

  1.   

    --第一种方法
    --第11条到第20条,共选出10条记录
    select *
    from (select top 10 * from (select top 20 * from 表名 order by ID) t1 order by ID desc) t2
    order by ID
    --第二种方法
    --第11条到第20条,共选出10条记录
    select top 10 *
    from 表名
    where ID>(select max(ID) from (select top 10 ID from 表名 order by ID) t1)
    order by ID
      

  2.   

    select id=IDENTITY(int, 1,1),* into temp from tableselect * from temp where id>= 30 and id <= 40
      

  3.   

    select top 10 * 
    from (select top 40 * from table order by id) t 
    order by id desc
      

  4.   

    select id=IDENTITY(int, 1,1),* into temp from tableselect * from temp where id>= 30 and id <= 40
    ====================
    多一个ID字段
      

  5.   

    select TOP 40 id=IDENTITY(int, 1,1),* into #T from TableName
    select * from #T where id>= 30 and id <= 40
    DROP TABLE #T
      

  6.   

    select TOP 40 id=IDENTITY(int, 1,1),* into #T from TableName
    select * from #T where id>=30
    DROP TABLE #T