Ranked Function in Oracle8.1.6 [message #21543] |
Mon, 12 August 2002 01:07 |
Bhagwan Singh
Messages: 23 Registered: December 2001
|
Junior Member |
|
|
hi,
using scott/tiger as login i have executed the following statement:
select deptno, sal, rank() over ( partition by deptno
order by sal desc) ranked_value from emp;
my output does not show rank 2 for deptno 20.How can I get the same?
Query Output:
DEPTNO SAL RANKED_VALUE
---------- ---------- ------------
10 5000 1
10 2450 2
10 1300 3
20 3000 1
20 3000 1
20 2975 3
20 1100 4
20 1000 5
30 2850 1
30 1600 2
30 1500 3
30 1250 4
30 1250 4
30 950 6
Desired Output:
DEPTNO SAL RANKED_VALUE
---------- ---------- ------------
10 5000 1
10 2450 2
10 1300 3
20 3000 1
20 3000 1
20 2975 2
20 1100 3
20 1000 4
30 2850 1
30 1600 2
30 1500 3
30 1250 4
30 1250 4
30 950 5
-Bhaggs
|
|
|
|