CodeIgniter 3.1查询中的未定义变量

时间:2016-12-28 09:40:48

标签: codeigniter codeigniter-3

我想在CodeIgniter V3查询中使用$this->db->between(); MySQL运算符。

我收到“未定义变量”错误。我怎样才能做到这一点?

Select id, name, firstValue, secondValue, CASE WHEN fistValue > secondValue THEN firstValue ELSE SecondValue END as Value, CASE WHEN value > 5 then 'something' END FROM SomeTable

1 个答案:

答案 0 :(得分:0)

您可以像这样使用between ......

$this->db->where("column_name BETWEEN value1 AND value2");

OR

像这样......

$this->db->where('column_name >=',value1);
$this->db->where('column_name <=', value2);

有关详情,请参阅此处.. using BETWEEN in WHERE condition