Frank_Rizzo - 11:18 am on Jul 31, 2012 (gmt 0)
Yes that could be an option but you have to watch the separators.
If you set product_category to a varchar(n) field you can then do this:
SELECT product_id FROM table WHERE product_category LIKE "%11" AND product_category LIKE "%14" AND product_category LIKE "%7"
But that would be incorrect because it would find records like this:
You would need to ensure that all the stored product_category ids have separators around them such as a comma or any other character
Now your select can look like this:
SELECT product_id FROM table WHERE product_category LIKE "~11~," AND product_category LIKE "~14~" AND product_category LIKE "~7~"
You could just use spaces if you wish
11 14 7
211 14 7
11 14 75
but I would use a specific character as it will be easier to spot mistakes.
As I said earlier though there is probably a direct mysql statement, which would extract your data as in your opening post. Something on the lines of subselects and unions.