这是我的代码:
$attendances = $this->Pupil->Attendance->find('all',
array(
'conditions'=>array(
'Pupil.group_id'=>$group,
'Attendance.date' >= $start,
'Attendance.date' <= $end
)
)
)
);
这是生成的 SQL:
SELECT [many different fields from a few tables] WHERE `Pupil`.`group_id` = 7 AND 1
$start 的值为 2011-06-06,end 为 2011-06-10(在视图中使用 debug() 验证)。
为什么 Cake 会生成条件“AND 1”,而忽略我的条件?
谢谢阅读!