通过记录的唯一ID,先把这N条记录的ID取出来,存放到临时表中,然后根据条件
原表.ID=临时表.ID+1这个条件来进行查询

解决方案 »

  1.   

    select * from table where not in name =?
      

  2.   

    假如你的表有主键ID,并且按ID来排序.select * from tb a left join (你搜的记录集) b on a.id=b.id+1 where b.任何一个字段 is not null
      

  3.   

    create proc pr_inc
          @base_num int,
          @incr_num int
    --@base_num为查找的n,@incr_num 为n以外要查找的n 
    as 
    select top (@base_num+@incr_num) * from table  --
    where table_id not in (select top @base_num table_id from table )
    --table 为你的源表,table_id为你源表的唯一标示符
    go--输入数值,查询结果
    exec pr_inc @base_num,@incr_num
      

  4.   

    create proc pr_inc
          @base_num int,
          @incr_num int
    --@base_num为查找的n,@incr_num 为n以外要查找的n 
    as 
    select top (@base_num+@incr_num) * from table  --
    where table_id not in (select top @base_num table_id from table )
    --table 为你的源表,table_id为你源表的唯一标示符
    go--输入数值,查询结果
    exec pr_inc @base_num,@incr_num