1.
select identity(int,1,1) id,* into #aa from tablename
select top 2 * from #aa where leixing='大柜' and id>=3
2.不对,试一下就知道了!
select top 2 * from #aa where leixing='大柜' and id>=9

解决方案 »

  1.   

    问题一:
    select top 2 * from tablename
    where bianhao not in (select top 3 from bianhao from tablename where leixing='大柜' order by bianhao)
    and leixing='大柜'
    order by bianhao
      

  2.   

    理解错了,再来,不知这次对不对?
    1.
    select identity(int,1,1) id,* into #aa from tablename where leixing='大柜'
    select top 2 * from #aa where id>=3
    2.对,试一试
    select top 2 * from #aa where id>=9
      

  3.   

    select identity(int)id ,* into #temp from yourtable
    --1.
    select top 2 *  from #temp where leixing = '大柜' and id >= 3 and (id - 3) % 2 = 0 
    --2
    select top 2 *  from #temp where leixing = '大柜' and id >= 9 and (id - 9) % 2 = 0 drop table #temp
      

  4.   

    select top 2 * from table where leixing = '大柜' and id not (select top 3 * from table where leixing = '大柜')