MySQL Forums
Forum List  »  MySQL Administrator

Re: Query Help
Posted by: Barry Galbraith
Date: August 04, 2009 10:16PM

Hi Ken,

while not having an exact specific answer, you might clues in the MySQL Reference Manual.
http://dev.mysql.com/doc/refman/5.0/en/join.html


This is in the comments section at the bottom, and might be the answer you are looking for.

Below is an example of how to left-join multiple tables independently.

SELECT ...
FROM table 1
LEFT JOIN table 2 on (table1.id = table2.id)
LEFT JOIN table 3 on (table1.id2 = table3.id2)
LEFT JOIN table 4 on (table1.id3 = table4.id3)


Good luck.

Ken,

I've come up with this select statement. I've built some tables with the fields you show (at least) and managed to join them.

Give this a try.

Good luck.

SELECT COUNT(p.products_id) as total, pd.language_id, p2c.categories_id
FROM ((manufacturers AS m LEFT JOIN products AS p ON m.maunfacturers_id = p.maunfacturers_id) LEFT JOIN products_description AS pd ON p.products_id = pd.products_id) LEFT JOIN products_to_categories AS p2c ON p.products_id = p2c.products_id
WHERE (((p.products_status)=1) AND ((pd.language_id)=1) AND ((p2c.categories_id)=44));



Edited 1 time(s). Last edit at 08/05/2009 06:08AM by Barry Galbraith.

Options: ReplyQuote


Subject
Written By
Posted
August 04, 2009 06:16PM
Re: Query Help
August 04, 2009 10:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.