Display all the details of employee who is getting 3rd highest salary in employee table.
There are many ways to do achieve the 3rd highest salary in the employee table.
Here my inner query will return the second highest salary and again from the results we have ignored the max of salary which means it is going to be the third-highest salary.
Hope you may try this one.
With Results As
(
Select * from employee
where
Salary Not IN (Select Max(Salary) From Employee group by deptid;
)
Select * from Results Where Salary Not In ( Select Max(Salary) from Results;
Try this and tell me.
Group by was missing at the end try this one.
With Results As
(
Select * from employee
where
Salary Not IN (Select Max(Salary) From Employee group by deptid;
)
Select * from Results Where Salary Not In ( Select Max(Salary) from Results group by deptid)