select top 300 * from [mytab] 
minus    
select top 249 * from [mytab] 

解决方案 »

  1.   

    这个查询得到的不是250到300条的记录吧?  select top 50 * from [mytab] 
        where [id] not in (select top 249 [id] from [mytab])
      

  2.   

    select top 300 * from [mytab]
    minus select top 249 * from [mytab]
      

  3.   

    或者:select * 
    from (select top 300 * from [mytab]) as a
    where [id] not in (select top 249 [id] from [mytab])
      

  4.   

    select top 50 *
    from ( select top 300 * from [mytab] )
    order by [id] desc
      

  5.   

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

  6.   

    select top 50 * from [mytab]
    where [id] in (
    select top 300 [id] from [mytab])
    order by [id] desc
      

  7.   

    谢谢各位的关注此问题,但是我在标题中注明了不用子查询的办法来取得最后50条记录,而且需要按照原排序,不能简单desc,前面black_snail(●龙飞虎○)写的这条 
    select top 300 * from [mytab] 
    minus    
    select top 249 * from [mytab] 
    我极感兴趣,可是在sql server里试验时出错,请各位按此思路再考虑考虑
     
      

  8.   

    minus在查询分析器中怎么不能用?