How can I write the following mysql query in cakephp:
如何在cakephp中编写以下mysql查询:
SELECT * FROM table WHERE DATE BETWEEN '2008-12-23' AND '2008-12-25';
SELECT * FROM表在'2008-12-23'和'2008-12-25'之间的日期?
1 个解决方案
#1
3
Using Cake's ORM, it would look something like this (where Model is the name of your model, usually a singularized version of your table name):
使用Cake的ORM,它看起来像这样(Model是模型的名称,通常是表名的单一化版本):
$this->Model->find('all', array('conditions' => array(
'Model.date BETWEEN ? AND ?' => array('2008-12-23', '2008-12-25')));
Check here for more details: http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
点击此处查看更多详情:http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
#1
3
Using Cake's ORM, it would look something like this (where Model is the name of your model, usually a singularized version of your table name):
使用Cake的ORM,它看起来像这样(Model是模型的名称,通常是表名的单一化版本):
$this->Model->find('all', array('conditions' => array(
'Model.date BETWEEN ? AND ?' => array('2008-12-23', '2008-12-25')));
Check here for more details: http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
点击此处查看更多详情:http://book.cakephp.org/2.0/en/models/retrieving-your-data.html