How to find the Nth Highest Salary in the Table?

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

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

Query:


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