miahmiah900
Programmer
This is, I think, a strange question. I have solved the problem using a different method, but I would like to know if anyone has any input on the following:
I am performing a SELECT similar to the following:
SELECT inventory_id FROM tbl_option_key WHERE data_id IN (3,7)
What this gives me is an inventory_id for each row that contains EITHER 3 or 7 in the data_id column. What I would like to do, is to have a query that returns the inventory_id only if it matches ALL entries in the "IN" list.
This may seem illogical, but the reason I want to do this is because there needs to be 0 or many entries in tbl_option_key for each inventory_id.
The method I used to solve this method is a GROUP BY on the inventory_id field and counting the number of matches to see if the total is the same as the number of entries in the "IN" list.
Any suggestions?
Thanks!
-miah
I am performing a SELECT similar to the following:
SELECT inventory_id FROM tbl_option_key WHERE data_id IN (3,7)
What this gives me is an inventory_id for each row that contains EITHER 3 or 7 in the data_id column. What I would like to do, is to have a query that returns the inventory_id only if it matches ALL entries in the "IN" list.
This may seem illogical, but the reason I want to do this is because there needs to be 0 or many entries in tbl_option_key for each inventory_id.
The method I used to solve this method is a GROUP BY on the inventory_id field and counting the number of matches to see if the total is the same as the number of entries in the "IN" list.
Any suggestions?
Thanks!
-miah