我需要在一年的间隔内用cakephp获取记录。我试过按time查询条件不起作用。
$accept = $this->AssignListing->find('all',array('conditions' => array('AssignListing.writer_id' => $writer,'AssignListing.status' => 1, 'AssignListing.date_added > NOW( ) - INTERVAL 1 YEAR')));

最佳答案

这对你有用。

$accept = $this->AssignListing->find('all',array('conditions' => array('AssignListing.writer_id' => $writer,'AssignListing.status' => 1, 'AssignListing.date_added >=' => 'DATE_ADD(NOW( ), INTERVAL -1 YEAR')));

关于php - 在cakephp中获取当年的mysql记录,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11825019/

10-09 22:26