You are here: Re: PHP and MySQL question « PHP Programming Language « IT news, forums, messages
Re: PHP and MySQL question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация