问题是在find()方法中有什么方法可以使用MySQL
WHERE...IN
条件。例如:
SELECT * FROM `table` WHERE `id` IN (1,2,3);
答案 0 :(得分:2)
是的,只需使用conditions => array(field => array(values))就像这样
$conditions = array ( 'Model.field' => array (1,2,3,4) );
$this->Model->find('all', array('conditions' =>$conditions) );
这将执行像这样的WHERE条件
SELECT ....
FROM ...
WHERE "Model".field IN (1,2,3,4);