这个问题经常讨论,以往的贴子有很多,提供一种方法
有ID列,select top 100 from table where id not in (select top 150 id from table)
选出151到250条记录。

解决方案 »

  1.   

    select IDENTITY(int,1,1) as aid,* into ##temp FROM LOWMAINgo1st 100:
    select * from ##temp where aid <=100
    2nd 100:
    select * from ##temp where aid >100 and aid <=200
    3th 100:
    select * from ##temp where aid >200 and aid <=300
    ...
      

  2.   

    怎样利用SQL语句进行分页显示select Top pageSize *
      from T
     where SortField NOT IN (select Top pageSize*pagei SortField
                              from T
                             order by SortField )
    order by SortField例如,每页7条,列印第7页:
    select Top 10 *
      from T
     where SortField NOT IN (select Top 70 SortField
                              from T
                             order by SortField )
    order by SortField
      

  3.   

    --if有ID列
       select top 100 from  Utable
       where ID not in (select top 200 ID from Utable)
       
       ---if need sort
       select top 100 from  Utable
       where ID not in (select top 200 ID from Utable order by ID )
       order by ID--if not 有ID列
      select identity(int,1,1) as ID ,*  
      into #T from Utable  
      --order by....
      select top 100 from  #T
      where ID not in (select top 200 ID from #T)