I need to find the IDs and names of the employees whose salaries are at least 10% higher than the average salary of all employees. I can't get the code to work with the 10% higher than the average. I know how to get the average, but when I run my particular code, I get all names and know that it's not running correctly.
Here is my query:
Select employees.eid,
CONCAT(efirstName,
' ', eLastName) AS Name
from employees
GROUP BY employees.salary
HAVING employees.salary > avg(salary * .10);
I have also tried:
Select employees.eid,
CONCAT(eFirstName,
' ',
eLastName AS Name
FROM employees
GROUP by eLastName
HAVING avg(salary) > avg(salary * .10);