我是 kohana 的新手。我正在使用 ORM 来获取数据。
我想建立一个查询,其中BETWEEN
有哪个子句。如下
SELECT `rooms`.* FROM `rooms` LEFT JOIN `events` ON (`rooms`.`id` = `events`.`room_id`)
WHERE `events`.`room_id` IS NULL
OR (`events`.`eventstart` NOT BETWEEN 1312210800 AND 1312218000)
为此,我正在做以下事情
$rooms = $room->join('events', 'LEFT')
->on('rooms.id', '=', 'events.room_id')
->where('events.room_id', 'IS', NULL)
->and_where_open()
->or_where('events.eventstart' , 'NOT BETWEEN', $from)
->and_where_close()
->find_all();
但我得到这样的查询
SELECT `rooms`.* FROM `rooms` LEFT JOIN `events` ON (`rooms`.`id` = `events`.`room_id`)
WHERE `events`.`room_id` IS NULL AND (`events`.`eventstart` NOT BETWEEN 1312210800)
有人可以指出如何使用 BETWEEN 子句