我有一个如下表结构
id wstage wstatus wdate
101 Unaquired create 2013-08-29 17:07:20.040
101 Unaquired rework 2013-08-29 18:07:20.040
101 inprocess accqui 2013-08-29 19:07:20.040
101 inprocess alloca 2013-08-29 20:07:20.040
101 Unaquired create 2013-08-29 21:07:20.040
101 Unaquired rework 2013-08-29 22:07:20.040
我必须像这样编号
id wstage wstatus wdate rownumber
101 Unaquired rework 2013-08-29 22:07:20.040 1
101 Unaquired create 2013-08-29 21:07:20.040 1
101 inprocess alloca 2013-08-29 20:07:20.040 2
101 inprocess accqui 2013-08-29 19:07:20.040 2
101 Unaquired rework 2013-08-29 18:07:20.040 3
101 Unaquired create 2013-08-29 17:07:20.040 3
我正在尝试使用功能
select *,ROW_NUMBER() over (partition by id,wstage order by wdate desc) rownumber
但这并没有提供所需的输出。我不想使用 pl/sql 是否有排名功能或简单查询来实现这一点。我的表有 5000 万条记录。