查询构建器对两列求和

时间:2015-07-06 08:28:21

标签: php mysql codeigniter

如何在codeigniter中添加数字? 代码

$this->db->where(array('is_active' => 1, 'time + duration <=' => time()));
$this->db->update('table', array('is_active' => 0));

将导致:

UPDATE `table` SET `is_active` = 0 WHERE `is_active` = 1 AND `time +` `duration` <= 1436170717

我想要

`time` + `duration`

1 个答案:

答案 0 :(得分:0)

我在它们之间添加了引号,但它确实有用。

$this->db->where(array('is_active' => 1, '\'time\' + \'duration\' <=' => time() ));