I looked up this and found some links on the forums here but none that i felt applied to my question, or seemed to have the same result as mine. What I need to do is this...
List all employee last name, first name, salary, and a “compare column” from more_employees tables if salary is more than salary average, this column ouput ‘High-Pay’ else output ‘Low-Pay’
What I've worked out is this...
SELECT first_name, last_name, salary,
CASE WHEN salary > AVG(salary) THEN 'High-Pay'
WHEN salary < AVG(salary) THEN 'Low-Pay'
ELSE 'Average' AS CompareColumn
END
FROM more_employees
The error I'm getting is that this is
"not a single-group group function"
so I add in a group by at the end with anyone one of the column names then I get
"Not a group-by function"
and so I am stuck and have been for awhile now. Any ideas?