How can you Find nth salary from table

Hi Friends,
You can find nth salary by this query


SELECT distinct(E.Salary) FROM
(SELECT Salary,dense_rank() OVER(ORDER BY Salary DESC)R FROM EMP)
E WHERE E.R=3


Comments

Author: Asheej T K16 Mar 2011 Member Level: Gold   Points : 2

Hi,

Thanks for sharing the query, but please post this in resource section. This is a forum section to clear your doubts.

Author: gaurav24 Mar 2011 Member Level: Bronze   Points : 0

hi jeet

it is very usefull query for learn

Author: Saroj Kumar Raut27 Jun 2011 Member Level: Silver   Points : 1

Select Min(fieldname) from tablename where fieldname not in( select top (N-1) fieldname from tablename order by asc)

where fieldname= Name of the column
tablename = Name of the table



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: