查询数据库的最后一条数据

   select * from tempdb..TempTable2012040609301854
    declare @autoid as integer
    select @autoid =autoid from tempdb..TempTable2012040609301854 order by iyperiod,corder
    print @autoid
    select * from tempdb..TempTable2012040609301854 where autoid = @autoid


    或者:


     select top 1 * from tempdb..TempTable2012040609301854 order by iyperiod desc,corder desc

posted @ 2012-04-06 11:15  银杏叶儿  Views(320)  Comments(0Edit  收藏  举报