You are here: Re: multiple joins « PHP SQL « IT news, forums, messages
Re: multiple joins

Posted by J.O. Aho on 10/14/61 11:36

Geradeaus wrote:
> Hello,
>
> I have a problem with the following, first let me explain the database situation :
>
> SELECT region.regionName, COUNT( addate.regionId ) AS Total
> FROM region
> LEFT JOIN addate ON (addate.regionId = region.regionId AND addate.level = 1)
> JOIN ad ON (addate.adId = ad.adId AND ad.adTypeId = 4)
> GROUP BY addate.regionId

SELECT region.regionName, COUNT( addate.regionId ) AS Total FROM region LEFT
JOIN addate ON (addate.regionId = region.regionId) JOIN ad ON (addate.adId =
ad.adId) WHERE ad.adTypeId = 4 GROUP BY addate.regionId

You can't have "OPTIONS" in your joins, those you have to place in your WHERE.
http://dev.mysql.com/doc/refman/5.0/en/join.html


//Aho

 

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

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