|
Help with Multiple Joins
Hi,
I am not very good building mysql queries using Joins. I hope someone can help me.
I have a table 'products' with id, name and category_id fields. I also have a table 'categories' with id and name fields. I also have a table 'product_extra_categories' which allows a product to be included in a category other than its primary one. It has fields id, product_id and category_id.
I need to display a list of products.id's and the categories.name where the products.category_id = the chosen category number or the product has the chosen category number as an extra category, ie product_extra_categories.product_id = products.id AND product_extra_categories.category_id = categories.id
I have tried many things and keep stuffing it up. Sorry for my poor explanation. Thanks in advance.
|