Welcome to WebmasterWorld Guest from 188.8.131.52
Forum Moderators: open
I have two columns, say 'widget_id' & 'category_id'.
select widget_id from tbl where category_id=9 gives me a list of widget_ids 1,2,3..100
My question - is there another way to find the answer to the following query without using a monster 'IN':
select distinct(category_id) from tbl where widget_id IN(1,2,3...100)
In other words and slightly more complex - "You're looking at widgets found in both category 9 AND 10 user, widgets that appear in category 9 & 10 also appear in categories 1,2,3..100".
Hope that makes sense.
Thanks in advance, C
select distinct(category_id) from tbl where widget_id IN (select widget_id from tbl_widgets where...)
Not sure if this helps you. But it would simplify the code if you are able to pull them from another table based on some logic/conditions...