请教   用sql语句查询某一表当中最后20条记录怎么写??

解决方案 »

  1.   

    可以参照一下sql server中的bottomcount函数
      

  2.   

    declare @r int
    select * into #t from t1
    set @r=@@rowcount-20
    set rowcount @r
    delete from #t
    set rowcount 0
    select * from #tdrop table #t
      

  3.   

    for i:=1 to 20 begin
    adoquery1.last;
    打印;
    adoquery1.prior; end;
      

  4.   

    adoquery1.last;
    判断是否大于20
    if adoquery1.recordcount>20 then 
      adoquery1.move(-20)
      

  5.   

    应该是 move  还是 moveby ,查一下就可以了。
      

  6.   

    select IDENTITY(smallint,1,1) AS ii, * into #tt from tablenameselect * into #t1 from (select top 5 * from #tt order by ii desc) aa order by iialter table #t1 drop column iiselect * from #t1
      

  7.   

    DebugXP()的方法绝对是好的。 不过如果此表的数据量太大的话速度就有可能下将些。