以下是我的情况:
'OR' => array( 'AND' => array( array('EventCompetitor.is_black' => 1),array('EventCompetitor.is_adult' => 1) ),'AND' => array( array('EventCompetitor.is_black' => 0),array('EventCompetitor.is_adult' => 0) ),),
AND ((`EventCompetitor`.`is_black` = 0) AND (`EventCompetitor`.`is_adult` = 0)) AND
现在,这不是我想要的,我想要这样的东西:
((`EventCompetitor`.`is_black` = 1) AND (`EventCompetitor`.`is_adult` = 1)) OR ((`EventCompetitor`.`is_black` = 0) AND (`EventCompetitor`.`is_adult` = 0))
任何想法,我该如何实现?
谢谢 !
您的“OR”键盘数组中的子项名称相同,第二个键有效地覆盖第一个.您需要将这些“AND”条件封装在自己的数组中,以防止密钥冲突.
原文链接:https://www.f2er.com/php/131832.html例如.代替:
'OR' => array( 'AND' => array( array('EventCompetitor.is_black' => 1),
做:
'OR' => array( array('AND' => array( array('EventCompetitor.is_black' => 1),array('EventCompetitor.is_adult' => 1) )),array('AND' => array( array('EventCompetitor.is_black' => 0),array('EventCompetitor.is_adult' => 0) )),