title: Nested Select with ZF2
body: <p>Trying to get a nested select using <code>Zend\Db\Sql\Select</code> and can't see anything at all in the documentation or on google.</p>
  
  <p>Wanting to do something like this:</p>
  
  <pre><code>SELECT 
      table1.*,
      (SELECT x,y,z FROM table2 WHERE table2.a = table1.a) as b
  FROM table1 
  </code></pre>
  
  <p>Without the nested select, it would look something like this:</p>
  
  <pre><code>$select = new Zend\Db\Sql\Select;
  $select
   -&gt;columns(array(
      '*'
   ))
   -&gt;from('table1')
  </code></pre>
  
  <p>ZF1 looked about creating a subSelect item and then adding it as an Expression inside the list of columns but in ZF2 it complains about an Expression needing to be a string.</p>
  
  <p>Edit: The nested-select needs to be as a column as I end up with multiplied rows when using GROUP BY on same column name. This is the correct query I'm trying to get into <code>Zend\Db\Sql\Select</code>:</p>
  
  <pre><code>SELECT
      users.id, 
      (SELECT count(explorations.id) FROM explorations WHERE user_id = users.id) as total_explorations, 
      count(villages.id)
  FROM 
      users
  INNER JOIN
      villages
          on (villages.user_id = users.id)
  GROUP BY 
      users.id
  </code></pre>