title: Sphinx complex queries with mix of AND/OR
body: <p>I've been looked around and have no luck on this.</p>
  
  <p>So I have a complex query to sphinx and wondering if I could do complex query of SQL like this</p>
  
  <pre><code>SELECT * FROM Table WHERE (categoryid in (17,18,19, 20) OR merchantid in (110,112,335)) AND brandid NOT in (20, 30, 40,50);
  </code></pre>
  
  <p>I know OR is working with SetSelect with</p>
  
  <pre><code>$s-&gt;SetSelect('*, IN(categoryid, 17,18 19) OR IN(merchantid,110,112, 335) AS test');
  $s-&gt;SetFilter('test', array(1), true);
  $s-&gt;query("", "index");
  </code></pre>
  
  <p>NOT query could be done as individual query </p>
  
  <pre><code>$s-&gt;SetSelect('*, IN(brandid,20,30,40,50 AS nottest');
  $s-&gt;SetFilter('nottest', array(1));
  $s-&gt;query("", "index");
  </code></pre>
  
  <p>But how should I combine both in one query</p>