如何在cakephp中编写以下mysql查询:
SELECT * FROM table WHERE DATE BETWEEN' 2008-12-23' AND' 2008-12-25';
答案 0 :(得分:3)
使用Cake的ORM,它看起来像这样(Model是模型的名称,通常是表名的单一化版本):
$this->Model->find('all', array('conditions' => array(
'Model.date BETWEEN ? AND ?' => array('2008-12-23', '2008-12-25')));
点击此处了解更多详情: http://book.cakephp.org/2.0/en/models/retrieving-your-data.html