title: Zend Framework 2 Sql Select with OR and AND
body: <p>I want to make this query using Zend\Db\Sql\Select:</p>
  
  <pre><code>SELECT table1.* FROM table1 
      INNER JOIN table2 ON table1.columnA = table2.columnB 
      INNER JOIN table3 ON table1.columnC = table3.columnD
  
  WHERE (table2.column2 = 2 or table3.column3 = 3) and table1.column1 = 1
  
  ORDER BY table1.columnE ASC LIMIT 1
  </code></pre>
  
  <p>I have this code so far:</p>
  
  <pre><code>/*@var $db Adapter */
  $db = $this-&gt;getServiceLocator()-&gt;get('db');
  $sql = new Sql($db);
  $select = $sql-&gt;select();
  
  $select-&gt;from('table1');
  $select-&gt;join('table2','table1.columnA = table2.columnB',array());
  $select-&gt;join('table3','table1.columnC = table3.columnD',array());
  
  $select-&gt;where(array('table2.column2' =&gt; 2, 'table2.column3' =&gt; 3), Predicate\PredicateSet::OP_OR);
  
  $select-&gt;where(array('table1.column1' =&gt; 1),Predicate\PredicateSet::OP_AND);
  
  $select-&gt;order('table1.columnE ASC');
  $select-&gt;limit(1);
  
  $statement = $sql-&gt;prepareStatementForSqlObject($select);
  $resultSet = $statement-&gt;execute();
  </code></pre>
  
  <p>But doesn't works, because produce this one (without the "(" and ")" for the OR):</p>
  
  <pre><code>SELECT table1.* FROM table1 
      INNER JOIN table2 ON table1.columnA = table2.columnB 
      INNER JOIN table3 ON table1.columnC = table3.columnD
  
  WHERE table2.column2 = 2 or table3.column3 = 3 and table1.column1 = 1
  
  ORDER BY table1.columnE ASC LIMIT 1
  </code></pre>
  
  <p>What can I do?</p>