How to find third or nᵗʰ maximum salary from salary table?

后端 未结 30 682
醉酒成梦
醉酒成梦 2020-11-30 16:30

How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way?

30条回答
  •  眼角桃花
    2020-11-30 17:26

    Just change the inner query value: E.g Select Top (2)* from Student_Info order by ClassID desc

    Use for both problem:

    Select Top (1)* from 
    (
     Select Top (1)* from Student_Info order by ClassID desc 
    ) as wsdwe
    order by ClassID 
    

提交回复
热议问题