How to find fifth highest salary in a single query in SQL Server

后端 未结 9 2492
暗喜
暗喜 2020-12-19 08:55

How to find fifth highest salary in a single query in SQL Server

9条回答
  •  醉酒成梦
    2020-12-19 09:34

    The below query to gets the Highest salary after particular Employee name.

    Just have a look into that!

    SELECT TOP 1 salary FROM (
        SELECT DISTINCT min(salary) salary
        FROM emp where salary > (select salary from emp where empname = 'John Hell') 
        ) a 
    ORDER BY salary
    

提交回复
热议问题