Index: nodequeue.module
===================================================================
--- nodequeue.module	(revision 15460)
+++ nodequeue.module	(working copy)
@@ -1894,1 +1894,1 @@
     $query->addExpression('COUNT(n.position)', 'count');

     $where = '';
+    $args = array();
+    $num = 1;
     foreach ($references as $qid => $reference) {
       if ($where) {
         $where .= ' OR ';
       }
-      $where .= 's.qid = :qid AND s.reference IN (:reference)';
-      $query->where($where, array(':qid' => $qid, ':reference' => $reference));
+      $where .= 's.qid = :qid' . $num . ' AND s.reference IN (:reference' . $num. ')';
+      $args[':qid' . $num] = $qid;
+      $args[':reference' . $num] = $reference;
+      $num++;
     }
+    $query->where($where, $args);

     $result = $query->execute();

