select top 20 * from tablename order by 排序字段 desc

解决方案 »

  1.   

    很简单
    select top 20 * from 表名 order by 字段(如id) desc
      

  2.   

    select top 20 * from taborder by id desc
      

  3.   

    学习中!本贴记住了desc关键字!
      

  4.   

    --转贴
    ---------------------------------------------------
    --最后N条记录
    --如果你的表中无任何字段可以判断记录的先后顺序,就用:declare @r int
    select * into #t from a
    set @r=@@rowcount-100 --100就是你的N
    set rowcount @r
    delete from #t
    set rowcount 0
    select * from #tdrop table #t
      

  5.   

    建立存储过程 :
    CREATE PROCEDURE findint
     AS
    truncate table temptable
    SELECT identity(int,1,1) FID,name,code,id into into #temp from youtab order by  id ascinsert temptable SELECT  name,code,id FROM #temp  where  FID<=20
    drop table #temp 
    select * from temptable