Work around of Rank() Over Function
671253Nov 19 2008 — edited Dec 4 2008Hi Gurus,
I want to find the top three earners in each department.
Now, I can do that using a Rank() Over function. The query is:
SELECT A.*
FROM (SELECT EMPID, DEPTID, SAL, RANK() OVER (PARTITION BY DEPTID ORDER BY SAL DESC) AS RANK
FROM EMP
) AS A
WHERE RANK = 1
Is there any other work around for this.?? Can we achieve the same thing using co-related subqueries or so?? If so, then please guide in the same.
Regards,
Amit
Edited by: user10624622 on Nov 19, 2008 1:03 AM