查询N-M条记录。
select IDENTITY(int,1,1) as iid,* into #temptable from yourtable
select top M * from #temptable where iid>=NOR:select top M * from yourTable where id not in(select top N-1 id from table)
ID为表具有唯一值的任何字段

解决方案 »

  1.   

    the simply way:
    select top 20 col1 from t1 
    minus
    select top 9 col1 from t1 
      

  2.   

    Or  select * from (select top 20 col1 from t1) tab1 join
                   (select top 9 col1 from t1) tab2 on tab1.col1 <> tab2.col1
      

  3.   

    CrazyFor(蚂蚁) 方法可以,可惜来迟一步!
    black_snail(●龙飞虎○) ,你的什么方法?不解...
      

  4.   

    select top 10 * from table where id not in (select top 100 id from table)
     select * from (select top 20 * from table order by id) a where id not in (select top 9 id from table order by id)
      

  5.   

    select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
    select * from #temp where ID_Num>10 and ID_Num<=20
      

  6.   

    推荐:
    exec('SELECT Top '+cast(@PageSize as varchar)+' * FROM T WHERE SortField NOT IN (SELECT TOP '+cast(@PageSize* @Pagei as varchar)+' SortField from T )')