Home Forums Article Discussions Article Discussions by Author Discuss content posted by ~~Hari.Bagra Find Nth Maximum from a Table... RE: Find Nth Maximum from a Table...
Amulya Dutta
SSC Veteran
Points: 230
More actions
August 17, 2009 at 11:49 pm
#1040634
top 5th Salary of every department
SELECT * FROM (
SELECT EMP_ID, DEPT_ID, SALARY, NAME
,RANK() OVER (PARTITION BY DEPT_ID ORDER BY SALARY DESC) AS RANKID
FROM EMP) A WHERE RANKID = 5