如何在cakephp中编写查询以查找从日期和上次日期之间的日期

时间:2014-03-30 11:24:22

标签: cakephp

我必须显示from_date和last_date介于当前日期之间的帖子。 $sql = "SELECT * FROM post WHERE status=1 AND CURDATE() between from_date AND last_date"; 如上面的查询工作正常,我将如何在cakephp中转换上面的查询?

1 个答案:

答案 0 :(得分:0)

查看this page

$this->Post->find('all', array('conditions' => array(
     'status' => 1,
     'from_date BETWEEN ? AND ?' => array($from_date, $last_date)
)));