如果我使用加入然后显示空查询,我想要来自3表和费用pericualr字段批次ID和学生ID的数据可能是空白的。
$this->db->select('*');
$this->db->from('fees_perticular');
$this->db->join('fee_cat', 'fees_perticular.fee_cat = fee_cat.id');
$this->db->join('batch', 'fees_perticular.batch= batch.id');
$this->db->join('stud_cat', 'fees_perticular.sud_cat = stud_cat.id');
$query = $this->db->get();
id | fee_cat | particular_name | desc |all |batch|admission|sud_cat|amount
1 | 1 | Annual Fees |Annual Fees |all |- |- |- |2000
2 | 2 | Tuition Fees |Tuition Fees|- |3 |- |- |1000
3 | 1 | Tuition Fees |vccvv |- |1 |- |- |1000
答案 0 :(得分:0)
请试试这个
$this->db->select('*')
$this->db->join('fee_cat','fees_particular.fee_cat=fee_cat.fee_cat_id','LEFT')
$this->db->join('batch','fees_particular.batch=batch.batch_id','LEFT')
$this->db->join('stud_cat','fees_particular.stud_cat=stud_cat.stud_cat_id','LEFT')
$this->db->get('fees_particular');