SELECT SAL FROM EMPLOYEE emp1 WHERE (
SELECT COUNT(DISTINCT SAL) FROM EMPLOYEE emp2
WHERE emp2.SAL >= emp1.SAL) = N
Here if N is 3 you can find 3rd highest salary ..
SELECT COUNT(DISTINCT SAL) FROM EMPLOYEE emp2
WHERE emp2.SAL >= emp1.SAL) = N
Here if N is 3 you can find 3rd highest salary ..
No comments:
Post a Comment