Codeigniter选择查询与AND和OR条件 [英] Codeigniter select query with AND and OR condition
本文介绍了Codeigniter选择查询与AND和OR条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从一个有三个条件的表中选择一个Codeigniter选择查询。
I want a Codeigniter select query from a table with three conditions in .
coditionis are
1. wrk_fld_exc = 140
2. wrk_cs_sts = Open
3. wrk_dlvrd_sts = Delivered OR wrk_cl_sts = Success
第三个条件是AND条件包含OR条件。
第一个和第二个是条件。
The third condition is an AND condition contains OR condition. First and second is And condition.
推荐答案
你可以这样编码:
$this->db->where('wrk_fld_exc',140);
$this->db->where('wrk_cs_sts','open');
$where = '(wrk_dlvrd_sts="open" or wrk_cl_sts = "Success")';
$this->db->where($where);
这篇关于Codeigniter选择查询与AND和OR条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文