Each component is defined elsewhere, so when we store the parts for a specific product, we just store the id's which link back to their source.
What I need to do is to get a list of all products belonging to a specific user, which has (for arguments sake) component 233, but does not have component 213.
What I have been doing is along the lines of the following:
Code: Select all
SELECT `tbl_products`.`prod_id`, `tbl_products`.`product_name` FROM `tbl_products` INNER JOIN `tbl_product_parts` ON (`tbl_products`.`prod_id` = `tbl_product_parts`.`prod_id`) WHERE (`tbl_products`.`owner_id` = '8') AND ((`tbl_product_parts`.`VI_ID` = '233') AND (`tbl_product_parts`.`VI_ID` <> '213'))Any assistance here would be greatly appreciated. Cheers