Thursday, December 17, 2009

Nth maximum salary employee details from employee table

replace n with any number.
Example : 2nd Highest,3rd highest......


SELECT * FROM emp E1 WHERE n = (SELECT COUNT(DISTINCT(E2.esal))FROM emp E2 WHERE E2.esal >= E1.esal)

No comments:

Post a Comment