I have a problem with a query I am running. I want to display the Empcode, Empname and postcode of all employees who satisfy the following: every stock item they sell has a price value above the average of all stock items.
So here is my query:
select distinct SU.empCode, SU.empName, SU.PostCode
from Suppliers SU, Stocks ST
where ST.Price >= (select AVG(Price) from Stocks ST)
I get all the employees back ( 6 in total ) but the correct answer is 2 employees.
Does anybody know what I’m doing wrong?
Any help would be appreciated, thanks.
this should work