Here is my table:
There are Multiple Salaries under 61,000.
The AVG Salary for Related table is 61K.
If I write a query:
SELECT `StaffID`, `Title`, `FirstName`, `LastName`, `DeptID`, `Salary`
FROM `Staff`
WHERE `Left` < '2018-00-00'
AND `ContractType` = 'Full time' *HAVING AVG(`Salary`) < `Salary`*;
It will produce one result with the Salary being 27000. The AVG Salary at 61K is not less than 27K.
If I change the comparison operator in the same query to:
*AVG(`Salary`) > `Salary`;*
No record will be produced.
Can anyone shine a light as to why?