I am using a anlaytic function called Rank() to display rank of salaries.
select deptno, ename, sal, rank() over (partition by deptno order by sal desc) r from emp order by deptno, sal desc
This is working fine. But here Rank is not giving continuous ranks.
I mean Let's say the data as follows.
DEPTNO ENAME SAL R
10 KING 5000 1
20 CLARK 2450 2
30 MILLER 1300 3
20 SCOTT 3000 1
20 FORD 3000 1
20 JONES 2975 3
20 ADAMS 1100 4
20 SMITH 800 5
30 BLAKE 2850 1
30 ALLEN 1600 2
30 TURNER 1500 3
30 MARTIN 1250 4
30 WARD 1250 4
30 JAMES 950 6
here if you see, if the 2 persons salaries are same the same rank is being assigned. This is fine. But for the next persion rank is being skipped to bigger rank.
In the above example for dept 20, the employee JONES rank is 3. I want to show it as 2.
How can we do this? Is there any possibility ?
Thank you, Regards
BI DWH BALA