MySQL IN() statements: Avoiding duplicate lists I need to check that two columns both appear in a list of IDs. So right now I have this:

SELECT 
    `main_table`.*
FROM
    `activities` AS `main_table`
WHERE
    (actor_id IN ('10027' , '11535'))
        AND (original_actor_id IN ('10027' , '11535'))


The problem is that the list of IDs can get pretty big; into the thousands. I can't find a way without another temp table that lets me check that two columns are in a list without defining the list twice. I'm concerned that it's an excessively large query to send back and forth from my PHP web server.
You can create a temp table, insert your parameters there and then join it:

create temporary table tmp (x int);
insert into tmp(x) values (10027),(11535);
select x.* 
from activities as x 
join tmp as y 
    on y.x = x.actor_id
join tmp as z
    on z.x = x.original_actor_id;