Question { 5809 }
how 2 find out nth salary.plz write sql qurires
Answer
Hi...
here is the query to find out the n'th maximum salary
note: 1.'emp' is Table name & 'sal' is column name.
2.'distinct' is used for finding the unique value
3.'count' is for counting the values.
Query:
------
SELECT * from emp
where sal = (SELECT distinct(sal) from emp x
where &n = (SELECT count(distinct(sal)) from
emp where sal >= x.sal));