我是cakephp的新手,想要这个查询 -
SELECT *
FROM TABLE_NAME
WHERE id=1
AND (country=INDIA OR country=JAPAN OR country=KOREA)
答案 0 :(得分:3)
$this->YourModel->find('all', array(
'conditions' => array(
'id' => 1,
'country' => array('INDIA', 'JAPAN', 'KOREA')
)));
答案 1 :(得分:2)
再多阅读Retrieving Your Data以更好地理解语法,试试看:
$countries = $this->Country->find('all', array(
'conditions' => array(
'id' => 1,
'OR' => array(
array('name' => 'INDIA'),
array('name' => 'KOREA'),
array('name' => 'JAPAN'),
)
)
));