How to Find Out Nth Highest Salary In SQL

Find Out lowest salary

We want to find lowest fourth salary.

  1. select top 1 salary from t1 where salary inselect distinct top 4 salary from t1 order by salary ascorder by salary desc   
Step 1:

If you wand second, third, fourth, nth lowest salary.

For example I want to find fourth lowest salary by this query we found out four lowest salary.
  1. select distinct top 4 salary from t1 order by salary asc   
Step 2:

Now we find top 1 highest salary form step-1 query by reverse in desc order.
  1. select top 1 salary from t1 where salary in   
  2. (   
  3. select distinct top 4 salary from t1 order by salary asc   
  4. )   
  5. order by salary desc   
You can find nth higest salary by replacing number like:
  1. select top 1 salary from t1 where salary in   
  2. (   
  3.    select distinct top n salary from t1 order by salary asc   
  4. )   
  5. order by salary desc   
Just try this, I hope it will help you.