Cakephp Sql 查询
Cakephp Sql Query
如何在 cakephp sql 查询方式中编写这些语句。
SELECT *
FROM `officers`
WHERE ((slot1_min<=00 AND slot1_max>=0) OR (slot2_min<=850 AND slot2_max>=850))
尝试:
$options = array(
'conditions' => array(
'OR' => array(
array(
'AND' => array(
array('slot1_min <=' => 0),
array('slot1_max >=' => 0),
)
),
array(
'AND' => array(
array('slot2_min <=' => 850),
array('slot2_max >=' => 850),
)
),
)
)
);
$officers = $this->Officer->find('all',$options);
如何在 cakephp sql 查询方式中编写这些语句。
SELECT *
FROM `officers`
WHERE ((slot1_min<=00 AND slot1_max>=0) OR (slot2_min<=850 AND slot2_max>=850))
尝试:
$options = array(
'conditions' => array(
'OR' => array(
array(
'AND' => array(
array('slot1_min <=' => 0),
array('slot1_max >=' => 0),
)
),
array(
'AND' => array(
array('slot2_min <=' => 850),
array('slot2_max >=' => 850),
)
),
)
)
);
$officers = $this->Officer->find('all',$options);