[英]CodeIgniter: Case in where clause
How do we state the case
in where
clause condition in CodeIgniter's active record? 我们如何在CodeIgniter的活动记录中的
where
子句条件中陈述case
?
Here is the query I want to achieve 这是我想要实现的查询
SELECT * FROM table WHERE idx =5342 and CASE WHEN reserve_date = 20151130 THEN reserve_time > 1537 ELSE reserve_date > 20151130 END
I tried to search on Google about this question but still could not find any answer. 我试图在谷歌上搜索这个问题,但仍然找不到任何答案。
You can write your condition in where clause
你可以在
where clause
写下你的条件
$this->db->select("*");
$this->db->where("idx",5342);
$this->db->where("CASE WHEN reserve_date = 20151130 THEN reserve_time > 1537 ELSE reserve_date > 20151130 END");
$query=$this->db->get("table");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.