List the Name of Employees who are taking the 2nd highest salary?

Syedshakeer
Posted by Syedshakeer under Sql Server category on | Views : 3277
List the Name of Employees who are taking the 2nd highest salary from the below Employee table ?

ID Name Salary
1 AAAA 10000
2 CCCC 5000
3 BBBB 5000
4 DDDD 3000
5 EEEE 3555


Ans)
select Name,salary from employee
where salary=(select min(salary) from employee
where salary in (select top 2 salary from employee order by salary desc))

OutPut:-
Name Salary
CCCC 5000
BBBB 5000

Comments or Responses

Login to post response