I use the following query to find the name of a city with more than 3 employees
SELECT M.NAME FROM MasterCity M INNER JOIN Employee E ON E.CityID = M.ID GROUP BY E.CityID HAVING count(E.CityID) >= 3;
This gives me the following error
Column 'MasterCity.Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
What's wrong. Thanks at Advance
source share