[英]How to select only value greater than 0?
In my query I want to discard the values equals to 0, actually this is my query: 在我的查询中,我想舍弃等于0的值,实际上这是我的查询:
$query = $this->db->select('GroupID')
->group_by('GroupID')
->from('ea_appointments')
->where('id_users_provider', $record_id)
->get()->result_array();
how you can see this query return only the GroupID value not equals so if I've: 如何查看此查询,仅返回不等于的GroupID值,因此,如果我已经:
0 - 0 - 1 - 1 - 2
0-0-1-1-2
(as GroupID). (作为GroupID)。
I get only: 我只有:
0 - 1 - 2
0-1-2
now I want to get only the value greater than 0, so thr query should be return this: 现在我只想获取大于0的值,因此thr查询应返回以下内容:
1 - 2
1-2
how I can achieve that in CodeIgniter? 如何在CodeIgniter中实现呢?
just add a where statement for the GroupID
and include the >
symbol at the end of the column name like so: 只需为
GroupID
添加一个where语句,并在列名的末尾添加>
符号,如下所示:
$query = $this->db->select('GroupID')
->group_by('GroupID')
->from('ea_appointments')
->where('id_users_provider', $record_id)
->where('GroupID >', 0)
->get()->result_array();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.