有这样的zend查询:
$select = $this->_table
->select()
->where('title LIKE ?', '%'.$searchWord.'%')
->where('description LIKE ?', '%'.$searchWord.'%')
->where('verified=1 AND activated=1');换句话说,它看起来是这样的:
SELECT `some_table`.* FROM `some_table` WHERE (title LIKE '%nice house%') AND (description LIKE '%nice house%') AND (verified=1 AND activated=1)如果我有一对情侣和句子,zend通过和操作符将它连接起来。如何将其与OR运算符连接?因为我需要:
...(title LIKE '%nice house%') OR (description LIKE '%nice house%')...您的帮助我们将不胜感激。
发布于 2010-08-21 15:45:30
$this->_table->select()->orWhere($condition);为了构建更复杂的查询(例如,子条件),您可能必须使用$this->table->getAdapter()->quoteInto()并手动编写SELECT。
发布于 2016-05-28 15:10:31
这里的其他答案都不起作用了,当前的解决方案是在where子句中调用nest()和unnest():
$select->where
->nest()
->equalTo('column1', 1)
->or
->equalTo('column2', 2)
->unnest()
->and
->equalTo('column3', 3);发布于 2014-01-31 14:29:21
我已经实现了你的zend查询
$select = $this->_table
->select()
->where('title LIKE ?', '%'.$searchWord.'%')
->ORwhere('description LIKE ?', '%'.$searchWord.'%')
->where('verified=1 AND activated=1');https://stackoverflow.com/questions/3536807
复制相似问题