shankar


{ City } chennai
< Country > india
* Profession * senior test engineer
User No # 17703
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 4
Users Marked my Answers as Wrong # 0
Questions / { shankar }
Questions Answers Category Views Company eMail




Answers / { shankar }

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));

Is This Answer Correct ?    4 Yes 0 No