How to find the Nth Highest Salary in the Table?

Posted by Sourabh07 under Sql Server category on | Points: 40 | Views : 1037
In the followin query:

'N' represents Nth Highest Salary eg: 1st Highest Salary, 2nd Highest Salary etc.


Select top(1) *
From Table_Name
Where Pk_ID_Column in
Select top(N) Pk_ID_Column
From Table_Name
Order by salary_column desc
Order by salary_column

Comments or Responses

Login to post response