Shanmuga Raj (3/20/2013)
Thanks.. its working !can you let me know why you have used
HAVING COUNT(*) = 4
That's to make it so that only those product_ids that have all 4 distinct product condition pairs are returned.
So far, there are some good answers to this problem, especially Chris' most recent post. My question is, what are you going to do when the conditions change where you might need to meet fewer or more than 4 pairs of conditions? Is this a one off or something where the conditions need to be passed by a GUI or passed by something else?
--Jeff Moden
Change is inevitable... Change for the better is not.