Zend Framework OR 运算符使用

Zend Framwork OR operator use

我正在使用

$where->equalTo('dailyshifthr.thrs', 0);
$where->equalTo('dailyshifthr.thrsA', 0);

我需要这两个条件为 OR 而不是 AND 条件。帮帮我。

您应该使用 or 谓词,例如:

$where->or->equalTo('dailyshifthr.thrs', 0);
$where->or->equalTo('dailyshifthr.thrsA', 0);

如果你想把这两个条件嵌套起来,比如

SELECT *
from your_table
where field_a = 1
and (dailyshifthr.thrs = 0 or dailyshifthr.thrsA = 0)

那么你必须使用nest谓词:

$where->equalTo('field_a', 1);
$nest = $where->nest;
$nest->or->equalTo('dailyshifthr.thrs', 0);
$nest->or->equalTo('dailyshifthr.thrsA', 0);