用SQL 想查个表,从6行开始,到第10行的纪录,如何写啊,一直写不对!!谢谢各位的帮忙!!!!!!!!!

解决方案 »

  1.   

    set rowcount 10
    select identity(int,1,1) as iden,* into # from 表
    set rowcount 0
    select * from # where iden between 6 and 10
    drop table #
      

  2.   

    select * from Table where ID in(select top10 ID from Table order by ...) and ID not in(select top5 ID from Table order by...)
      

  3.   

    1:
    select identity(int,1,1) as id ,* into # from 表
    select * from # where id between 6 and 10
    drop table #
    2:
    select * from 表 where 主键字段 between 6 and 10
      

  4.   

    select top 10-5 * from tablename where id not in (select top 5 id from tablename)
      

  5.   

    select identity(int,1,1) as id,* into # from tablename
    select * from # where iden between 6 and 10
      

  6.   

    -- sql 2005select *
    from(
        select *, rid=row_number() over(order by 排序字段)
        from tb
    )a 
    where rid between 6 and 100
      

  7.   

    select identity(int,1,1) as id ,* into table from 表
    select top 5 t.* from (select top 10 * from table order by id ) t order by t.id desc