Using IN clause in db_query I can't figure out how to add an IN clause in my query, using placeholders.

I'd want it to be something like:

$nids = array(1, 2, 3);
$result = db_query('SELECT * FROM {node} WHERE nid IN :nids', array(':nids' =&gt; $nids));


Can't find any documentation on this simple task. What's the proper way to achieve this?
You are missing the braces.

Try this:

$nids = array(1, 2, 3);
$result = db_query('SELECT * FROM {node} WHERE nid IN (:nids)', array(':nids' =&gt; $nids));


For more information, see http://drupal.org/node/310072, especially the chapter on Placeholder arrays:


  Placeholder arrays
  
  Drupal's database layer includes an extra feature of placeholders. If the value passed in for a placeholder is an array, it will be automatically expanded into a comma separated list as will the corresponding placeholder. That means developers do not need to worry about counting how many placeholders they will need.
  
  An example should make this behavior clearer:

&lt;?php
// This code:
db_query("SELECT * FROM {node} WHERE nid IN (:nids)", array(':nids' =&gt; array(13, 42, 144));

// Will get turned into this prepared statement equivalent automatically:
db_query("SELECT * FROM {node} WHERE nid IN (:nids_1, :nids_2, :nids_3)", array(
  ':nids_1' =&gt; 13, 
  ':nids_2' =&gt; 42, 
  ':nids_3' =&gt; 144,
));

// Which is equivalent to the following literal query:
db_query("SELECT * FROM {node} WHERE nid IN (13, 42, 144)");
?&gt;