SQL query to find Nth highest salary from a salary table

前端 未结 11 2235
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 10:45

How can I find the Nth highest salary in a table containing salaries in SQL Server?

11条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 11:12

    The easiest method is to get 2nd higest salary from table in SQL:

    sql> select max(sal) from emp where sal not in (select max(sal) from emp);
    

提交回复
热议问题