在Kohana数据库中列的BETWEEN

时间:2012-02-12 20:32:06

标签: php kohana kohana-3

如何指定

NOW() BETWEEN col1 AND col2

使用Kohana数据库?

$this->where(new Database_Expression('NOW()'), 'BETWEEN', array('col1', 'col2'));

显然将值视为字符串文字,而不是列名

2 个答案:

答案 0 :(得分:2)

你试过吗

$this->where(DB::expr('NOW() BETWEEN col1 AND col2'));

编辑:

$this->where('NOW()', 'BETWEEN', DB::expr('col1 AND col2'));

答案 1 :(得分:1)

阅读一些代码并获得它:

$this->where(null, null, new Database_Expression('NOW() BETWEEN col1 AND col2'));