HI All,
I Have a table like below,
I want to find the employees in each department who earn more than average salary in that department. How to write this query in SQL. Please help. I'm new to SQL Programming.
I tried the below query but it did not give the correct output.
Thank you.
I Have a table like below,
Code:
[b]EmpID Name Salary Department[/b]
I want to find the employees in each department who earn more than average salary in that department. How to write this query in SQL. Please help. I'm new to SQL Programming.
I tried the below query but it did not give the correct output.
Code:
select * from Employee E1 where Salary > (select avg(salary) from Employee E2 where E2.Department = E1.Department )
Thank you.