Zend-framework DB: OR instead of AND operator

have such zend query:

$select = $this->_table
               ->select()
               ->where('title LIKE  ?', '%'.$searchWord.'%')
               ->where('description LIKE  ?', '%'.$searchWord.'%')
               ->where('verified=1 AND activated=1');

In other words it looks like:

SELECT `some_table`.* FROM `some_table` WHERE (title LIKE '%nice house%') AND (description LIKE '%nice house%') AND (verified=1 AND activated=1)

If I have couple AND sentences, zend connect it through AND operator. How can I connect it with OR operator ? Cause I need:

...(title LIKE '%nice house%') OR (description LIKE '%nice house%')...

Your help would be appreciated.

10
задан Charles 6 April 2011 в 03:34
поделиться

1 ответ

$this->_table->select()->orWhere($condition);

Для построения более сложных запросов (например, подусловия) вам, возможно, придется использовать $ this-> table-> getAdapter () -> quoteInto () и напишите свой SELECT вручную.

25
ответ дан 3 December 2019 в 15:21
поделиться
Другие вопросы по тегам:

Похожие вопросы: