where 2 is the second max salary .
4th Max
select max(sal) from EMP A where 4=( select count(sal) From EMP B where B.sal>=A.sal)
5th Max
select max(sal) from EMP A where 5=( select count(sal) From EMP B where B.sal>=A.sal)
Nth Max
select max(sal) from EMP A where N=( select count(sal) From EMP B where B.sal>=A.sal)
No comments:
Post a Comment
Please post your comments here.....