简体   繁体   中英

combining results of two select objects Zend\Db\sql\sql

I know the way to combine two select statments would look like this:

 SELECT tableA.Id
 FROM tableB 
 INNER JOIN tableA ON [tableB].Id = tableA.Owner

 UNION

 SELECT tableA.Id, tableA.Name
 FROM [tableC] 
 RIGHT OUTER JOIN tableA ON [tableC].tableAId =  tableA.Id

But how would it be if I'm using sql object?

   $sql = new Sql($adapter);
   $select = $sql->select();
   $select ->from(tableA);
   $select ->join(...)

Any help would be much appreciated. Thanks in advance

ZF2 does have combine that works as union -

$select1->combine($select2);

I hope its helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM