Q:

SQL query to match multiple values to a field in select statement

I want to select distinct values of Column A where Column B = any members of a set S.
Is there a way to do this directly in SQL without looping and then filtering afterwards in code?
Thanks
EDIT: The set S is a PHP array. Does this make a difference?

A:

Use the IN clause with a list of values, or a subquery (not sure if supported in MySql since I use Oracle). The match can be on more than one column.
SELECT column_a
  FROM mytable
 WHERE column_b IN (1, 2, 3)

SELECT column_a
  FROM mytable
 WHERE column_b IN (SELECT column_c FROM myothertable)

