Earning of employees more than their managers

Write a query for Earning of employees more than their managers.

Example

Table: Employee            
ID  NAME    Salary  ManagerID
1   Ram     70000   3
2   Shyam   80000   4
3   Sheeta  60000   NULL
4   Geeta   85000   NULL

Result: Ram

Mysql

select e.Name as Employee 
from Employee e join 
Employee e1 on (e.ManagerId=e1.Id
where e.Salary>e1.Salary;


No comments:

Post a Comment