SQL query to find Nth highest salary

前端 未结 9 820
清酒与你
清酒与你 2020-12-15 01:52

I am referring to following query to find Nth highest salary of a employee.

select sal from emp t where &n = (select count(sal) from (select distinct sal         


        
9条回答
  •  情深已故
    2020-12-15 02:30

    To get the nth highest salary value just put the value of 'N'.

    Select Min(Salary) From (Select Top N * From Table_Name Order by Salary Desc);
    

提交回复
热议问题