Can someone steer me in the right direction with this query? I'm trying to select any product from the product table who's product_id matches any product_id's from the other three tables.
What i have doen't work. Any ideas?
<cfquery name="get_prod_by_catmatocc" datasource="#ds#">
SELECT a.product_id, a.title, a.price, a.img_thumb
FROM products a, product_materials_matrix b, product_sub_categories c,
product_category_matrix d
WHERE a.product_id = b.product_id
AND a.product_id = c.product_id
AND a.product_id = d.product_id
AND b.material_id = #url.matid#
AND c.sub_category_id = #url.occid#
AND d.category_id = #url.catid#
</cfquery>
What i have doen't work. Any ideas?
<cfquery name="get_prod_by_catmatocc" datasource="#ds#">
SELECT a.product_id, a.title, a.price, a.img_thumb
FROM products a, product_materials_matrix b, product_sub_categories c,
product_category_matrix d
WHERE a.product_id = b.product_id
AND a.product_id = c.product_id
AND a.product_id = d.product_id
AND b.material_id = #url.matid#
AND c.sub_category_id = #url.occid#
AND d.category_id = #url.catid#
</cfquery>