在我的 crossing_cash_memo
表中 due_to
列中,值为 consignee
,cash
其他为 Null.I想要隐藏 cash
数据并显示剩余数据,但未显示我的空数据。
我正在尝试这样:
public function fetchDue($rec_type){
$query = $this->db->select('user.user_full_name as consignor,user1.user_full_name as consignee,c.*')
->from('crossing_cash_memo c')
->join('ts_users user', 'c.consignor_name=user.user_id')
->join('ts_users user1', 'c.consignee_name=user1.user_id')
->where('c.memo_status','cash_memo')
->where_not_in('c.due_to','cash')
->order_by('c.lr_no','asc')
->get();
return $query->result();
}
我如何在 where 条件下显示 NULL
记录
最佳答案
试试这个
public function fetchDue($rec_type){
$query = $this->db->select('user.user_full_name as consignor,user1.user_full_name as consignee,c.*')
->from('crossing_cash_memo c')
->join('ts_users user', 'c.consignor_name=user.user_id', 'left')
->join('ts_users user1', 'c.consignee_name=user1.user_id', 'left')
->where(array('c.memo_status' => 'cash_memo', 'c.due_to !=' =>'cash'))
->order_by('c.lr_no','asc')
->get();
return $query->result();
}
关于php - 我想在where条件下访问null的记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57336183/