0

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

1
  • There's still no union available in Zend\Db\Sql\Select. Check this post. Commented Apr 29, 2014 at 5:06

1 Answer 1

2

ZF2 does have combine that works as union -

$select1->combine($select2);

I hope its helps someone.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.