foxxo (3/20/2013)
SELECT DISTINCT product_id
FROM fact_sales
WHERE (agent_id=1 AND product_code in (1))
OR (agent_id=2 AND product_code in (3))
OR (agent_id=3 AND product_code in (2))
OR (agent_id=4 AND product_code in (1))
AND & OR operators
I'm pretty sure the OP wants a return of only those things that meet all 4 pairs of conditions. By itself, OR just isn't going to do it.
--Jeff Moden
Change is inevitable... Change for the better is not.