Re: select using 2 left joins
Hi Jed, you aree totally right. The statement I typed should indeed be: WHERE tableName.manufacturersID=12 Meaning I got the ambiguity error. thx for the tip, Wilbert - Original Message - From: "Jed Verity" <[EMAIL PROTECTED]> To: "Wilbert Enserink" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, September 02, 2002 6:38 PM Subject: Re: select using 2 left joins > I'm a little surprised that MySQL isn't giving you an error on the ambiguity > of manufacturersID=12. What happens if you specify > tableName.manufacturersID=12? > > HTH, > Jed > > On the threshold of genius, Wilbert Enserink wrote: > > > Hi all, > > > > > > I'm having troubles with a good selection statement in my query. > > > > I have three tables: > > tableAds, tableProducts and tableManufacturer. They all have unique ID's > > defined. > > In the tableProducts there is a column named manufacturerID. So I know which > > product was made by which manufacturer. > > > > In the tableAds I have a column ProductsID so I know what Product is > > advertised. > > Now I want to find all the adsvertisments of products which are made by a > > specific manufacturer. > > I'm trying a query like: > > > > SELECT * FROM tableAds LEFT JOIN tableProducts ON > > (tableProducts.productsID=tableAds.productsID) LEFT JOIN tableManufacturers > > ON (tableManufacturers.manufacturersID=tableProducts.manufacturersID) WHERE > > manufacturersID=12 > > > > However this query returns all advertisments in the tableAds and not the Ads > > wirth manufacturer number 12 involved. > > > > Anybody knows how to improve this query? > > Any help would be much appreciated. thx in advance. > > > > Wilbert Enserink > > > > - > > Pas de Deux > > Van Mierisstraat 25 > > 2526 NM Den Haag > > tel 070 4450855 > > fax 070 4450852 > > http://www.pdd.nl > > [EMAIL PROTECTED] > > - > > > > - > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: select using 2 left joins
I'm a little surprised that MySQL isn't giving you an error on the ambiguity of manufacturersID=12. What happens if you specify tableName.manufacturersID=12? HTH, Jed On the threshold of genius, Wilbert Enserink wrote: > Hi all, > > > I'm having troubles with a good selection statement in my query. > > I have three tables: > tableAds, tableProducts and tableManufacturer. They all have unique ID's > defined. > In the tableProducts there is a column named manufacturerID. So I know which > product was made by which manufacturer. > > In the tableAds I have a column ProductsID so I know what Product is > advertised. > Now I want to find all the adsvertisments of products which are made by a > specific manufacturer. > I'm trying a query like: > > SELECT * FROM tableAds LEFT JOIN tableProducts ON > (tableProducts.productsID=tableAds.productsID) LEFT JOIN tableManufacturers > ON (tableManufacturers.manufacturersID=tableProducts.manufacturersID) WHERE > manufacturersID=12 > > However this query returns all advertisments in the tableAds and not the Ads > wirth manufacturer number 12 involved. > > Anybody knows how to improve this query? > Any help would be much appreciated. thx in advance. > > Wilbert Enserink > > - > Pas de Deux > Van Mierisstraat 25 > 2526 NM Den Haag > tel 070 4450855 > fax 070 4450852 > http://www.pdd.nl > [EMAIL PROTECTED] > - > > - > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
select using 2 left joins
Hi all, I'm having troubles with a good selection statement in my query. I have three tables: tableAds, tableProducts and tableManufacturer. They all have unique ID's defined. In the tableProducts there is a column named manufacturerID. So I know which product was made by which manufacturer. In the tableAds I have a column ProductsID so I know what Product is advertised. Now I want to find all the adsvertisments of products which are made by a specific manufacturer. I'm trying a query like: SELECT * FROM tableAds LEFT JOIN tableProducts ON (tableProducts.productsID=tableAds.productsID) LEFT JOIN tableManufacturers ON (tableManufacturers.manufacturersID=tableProducts.manufacturersID) WHERE manufacturersID=12 However this query returns all advertisments in the tableAds and not the Ads wirth manufacturer number 12 involved. Anybody knows how to improve this query? Any help would be much appreciated. thx in advance. Wilbert Enserink - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php