title: How to use union in zend db
body: <p>In sql i am using union i don't know how to write it in zend db.</p>
  
  <pre><code>select m.*, 0 as is_shared from test m where user_id = $userId 
  union
  select m.*,1 as is_shared from test m 
  join test_shares ms 
  where m.test_id = ms.test_id 
  and ms.email_address = $email 
  and m.url is not null;
  </code></pre>
  
  <p>Please help me out....</p>
  
  <p>I tried like this but no use</p>
  
  <pre><code>$cols1 = array('test.*,0 as is_shared');
  $select1 = $db-&gt;select ()
      -&gt;from ( 'test', $cols1 )
      -&gt;where ( 'user_id = ?', $userId);
  
  $cols2 = array('test_shares.*', '1 as is_shared');
  $select2 = $db-&gt;select ()
      -&gt;from ( 'test', $cols2 )
      -&gt;join ( 'test_shares', array () )
      -&gt;where ( 'test.test_id = test_shares.test_id')
      -&gt;where ( 'test_shares.email_address = ?',  $email)
      -&gt;where ( 'test.url is NOT NULL');
  
  $select = $db-&gt;select()
               -&gt;union(array($select1, $select2))
               -&gt;order('title');
  </code></pre>
  
  <p>It is taking 'test'.'0' AS 'is_shared' like this but i need like this 0 as is_shared.
  It is taking 'test'.'1' AS 'is_shared' like this but i need like this 1 as is_shared.</p>