简体   繁体   English

如何删除where子句(zend框架)上的特定条件?

[英]How to remove a specific condition on the where clause (zend framework)?

I have the following query generated by the default library of a third party framework 我有以下查询由第三方框架的默认库生成

SELECT COUNT(*) AS "total_rows" FROM "papers" WHERE (papers.paper_trash=0 OR papers.paper_trash IS NULL) AND (paper_category_id='7') AND (qtdavaliacoes='0')

I know that if I use a $query->reset(Zend_Db_Select::WHERE); 我知道如果我使用$query->reset(Zend_Db_Select::WHERE); it will clear the where clause completely, is it possible to clear only the AND (qtdavaliacoes='0') condition from it using zend? 它将完全清除where子句,是否可以使用zend从其中仅清除AND (qtdavaliacoes='0')条件?

As per the documentation , it is not possible to reset only part of the WHERE condition. 根据文档 ,不可能仅重设WHERE条件的一部分。 You would need to either: 您将需要:

  • reset the whole WHERE condition and add the ones needed ; 重置整个WHERE条件并添加需要的条件;
  • re-instantiate your object and re-build your query all over again. 重新实例化对象,然后重新构建查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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