我需要将下面的mysql条件转换为Cakephp find条件。
select * from bookings where (check_out_date - check_in_date) <=600 ;请帮帮我。
发布于 2013-01-04 19:50:11
$this->Booking->find('all', array(
'conditions' => array(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
)
));发布于 2013-01-04 18:37:23
尝试以下代码并对其进行调试。
$bookings = $this->Booking->find('all',array
(
'conditions' => array
(
'(Booking.check_out_date - Booking.check_in_date) <=' => 600
),
'fields' => array
(
'Booking.*'
),
'recursive' => -1
));上面的代码已经过测试,效果很好。
https://stackoverflow.com/questions/14155266
复制相似问题