|
Posted by Steve on 09/26/58 11:30
> SELECT C.CityID, C.Description, COUNT(R.CityID) AS N FROM tblcities C
> LEFT OUTER JOIN tblrentalswanted R ON C.CityID = R.CityID LEFT OUTER JOIN
> tblprovinces P ON C.ProvinceID = P.ProvinceID WHERE N > 0 GROUP BY C.CityID
> ORDER BY C.Description
> The error is: "Unknown column in Where clause 'N' ".
> It is self explanatory but why can I not do this.
> What is the alternative to select all fields where aggregated field is
> greater than certain condition?
Change to:
SELECT C.CityID, C.Description, COUNT(R.CityID) AS N FROM tblcities C
LEFT OUTER JOIN tblrentalswanted R ON C.CityID = R.CityID
LEFT OUTER JOIN tblprovinces P ON C.ProvinceID = P.ProvinceID
WHERE COUNT(R.CityID) > 0 GROUP BY C.CityID
ORDER BY C.Description
---
Steve
Navigation:
[Reply to this message]
|