select * ,identity(int,1,1) as sid into # from tb
select * from # where sid between 31 and 40
drop table #

解决方案 »

  1.   

    最直接的办法
    select * 
    from (select top 10 *
          from (select top 40 *
                from tablename
                order by ordercolumn) a
          order by ordercolumn desc) b
      

  2.   

    select top 10 * from 表
    where 主键 not in (select top 30 主键 from 表 order by 主键
    )order by 主键
      

  3.   

    select top 40 col into #aa from tb order by  col
    select top 10 col into #bb from #aa order by  col 
    select * from #aa where col not in (select col from #bb)col为主键,tb为表