Codeigniter 使用 AND 和 OR 条件选择查询 [英] Codeigniter select query with AND and OR condition

查看:23
本文介绍了Codeigniter 使用 AND 和 OR 条件选择查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个 Codeigniter 从表中选择查询,其中包含三个条件.

I want a Codeigniter select query from a table with three conditions in .

1. wrk_fld_exc = 140
2. wrk_cs_sts = Open
3. wrk_dlvrd_sts = Delivered OR wrk_cl_sts = Success

第三个条件是 AND 条件包含 OR 条件.第一个和第二个是 And 条件.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆