如何指定
NOW() BETWEEN col1 AND col2
使用Kohana数据库?
$this->where(new Database_Expression('NOW()'), 'BETWEEN', array('col1', 'col2'));
显然将值视为字符串文字,而不是列名
答案 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'));