Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend Framework DB Complex Where Or condition

How can I do a SELECT like this using Zend Framework Table.

SELECT * FROM table WHERE (field1 = 0 AND field2 = 1) OR (field2 = 0 AND field3 = 1)

Using just $table->orWhere() dont allow me to do multiple conditions inside of a parentheses

like image 870
João Mosmann Avatar asked Apr 28 '26 23:04

João Mosmann


1 Answers

To build complex queries:

// Zend_Db_Table
$this->getAdapter()->quoteInto('(field1 = 1 AND field2 =2) OR ...');

Here is a comprehensive article for more information.

like image 125
Zachary Schuessler Avatar answered Apr 30 '26 11:04

Zachary Schuessler