Answer: The query is wrong because we cannot use Aggregate Function for filtering in a WHERE clause. Instead we need to use HAVING. The correct query is
SELECT Name, MaxSal = Max(Salary)
FROM tblEmployees
GROUP BY Name
HAVING Max(Salary) > 5000;
|
Alert Moderator