codeigniter在find_in_set中添加IS NULL [英] codeigniter adding the IS NULL in the find_in_set
本文介绍了codeigniter在find_in_set中添加IS NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过 codeigniter 框架生成查询时
$this->db->select('id,memo,sent_to,sent_by,read_by,date')->from('memos')
->where("FIND_IN_SET('1',`sent_to`)")->order_by('`id`','DESC')->get();
我在查询中自动添加 IS NULL 时出错
i got an error of adding IS NULL in the query automatically
它产生
SELECT `id`, `memo`, `sent_to`, `sent_by`, `read_by`, `date` FROM `memos`
WHERE FIND_IN_SET('1',`sent_to`) IS NULL ORDER BY `id` DESC
代替
SELECT `id`, `memo`, `sent_to`, `sent_by`, `read_by`, `date` FROM `memos`
WHERE FIND_IN_SET('1',`sent_to`) ORDER BY `id` DESC
推荐答案
您需要添加!=0
是您的where clause
才能删除IS NULL
You need to add !=0
is your where clause
to remove IS NULL
$this->db->select('id,memo,sent_to,sent_by,read_by,date')->from('memos')
->where("FIND_IN_SET('1',`sent_to`)!=",0)->order_by('`id`','DESC')->get();
这篇关于codeigniter在find_in_set中添加IS NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文