Cakephp Sql查询
如何以cakephp sql查询方式编写此类语句Cakephp Sql查询,php,mysql,cakephp,cakephp-2.3,Php,Mysql,Cakephp,Cakephp 2.3,如何以cakephp sql查询方式编写此类语句 SELECT * FROM `officers` WHERE ((slot1_min<=00 AND slot1_max>=0) OR (slot2_min<=850 AND slot2_max>=850)) 选择* 来自“军官” 式中((slot1_min=0)或(slot2_min=850)) 试试看: $options = array( 'conditions' => array(
SELECT *
FROM `officers`
WHERE ((slot1_min<=00 AND slot1_max>=0) OR (slot2_min<=850 AND slot2_max>=850))
选择*
来自“军官”
式中((slot1_min=0)或(slot2_min=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);
$options=array(
“条件”=>数组(
'或'=>数组(
排列(
'和'=>数组(
数组('slot1_min='=>0),
)
),
排列(
'和'=>数组(
数组('slot2_min='=>850),
)
),
)
)
);
$officers=$this->Officer->find('all',$options);