我在Oracle中遇到一些特定选择的问题:
假设我们有一个选择返回这些元素:
Person Evaluation Date Hour Bryan A 10/12/2013 9:00 Ed D 10/12/2013 9:00 Julia A 10/12/2013 9:00 Will F 10/12/2013 9:00 Bryan B 10/12/2013 14:00 Ed C 10/12/2013 14:00 Julia A 10/12/2013 14:00 Will C 10/12/2013 14:00
我希望能够在我的查询中为每个特定元素的出现增加一个值,如:
Person Evaluation Date Hour Nb Bryan A 10/12/2013 9:00 1 Ed D 10/12/2013 9:00 1 Julia A 10/12/2013 9:00 1 Will F 10/12/2013 9:00 1 Bryan B 10/12/2013 14:00 2 Ed C 10/12/2013 14:00 2 Julia A 10/12/2013 14:00 2 Will C 10/12/2013 14:00 2
我尝试了一个over(xxx按xxx分区)的dense_rank(),但我只有那个:
Person Evaluation Date Hour Nb Bryan A 10/12/2013 9:00 1 Ed D 10/12/2013 9:00 2 Julia A 10/12/2013 9:00 3 Will F 10/12/2013 9:00 4 Bryan B 10/12/2013 14:00 1 Ed C 10/12/2013 14:00 2 Julia A 10/12/2013 14:00 3 Will C 10/12/2013 14:00 4
答案 0 :(得分:0)
尝试删除partition by
子句:
dense_rank() over (order by xxx)
在你的情况下,那将是:
dense_rank() over (order by "hour")