我需要将以下mysql条件转换为Cakephp查找条件。
select * from bookings where (check_out_date - check_in_date) <=600 ;
请帮帮我。
答案 0 :(得分:2)
$this->Booking->find('all', array(
'conditions' => array(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
)
));
答案 1 :(得分:-1)
尝试使用代码并进行调试。
$bookings = $this->Booking->find('all',array
(
'conditions' => array
(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
),
'fields' => array
(
'Booking.*'
),
'recursive' => -1
));
以上代码经过测试,就像魅力一样。