在查看 sybase 文档后,您似乎有一个 rank 函数。所以这里是一个刺:
declare @table table ( tp varchar(30), rowtime datetime, quantity int)
insert @table select 'cat1 1', '20120101', 50
insert @table select 'cat2 1', '20130101', 50
insert @table select 'cat3 1', '20110101', 50
insert @table select 'cat4 1', '20100101', 50
insert @table select 'cat5 1', '20090101', 50
select * from (
select *, RANK() OVER (ORDER BY RowTime DESC) AS Rank from @table
) a
where [RANK]=1
从这里获得排名功能:http:
//infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00169.1270/html/iqperf/ CEGDJFCE.htm