select * from employee
select top 1 salary from
(select top 2 salary from employee order by(salary) desc )a
It first select top 2 salary from table and arrange them in descending order now we have the second highest salary in second number then select top 1 by ascending it that is the second highest salary.
Asked In: few interviews |