Q: Codeigniter Active Record / MySQL Join Query - How to Return Results if one of the Table Rows is Not Present I have the following query:
$this->db
     ->select('SQL_CALC_FOUND_ROWS null as rows
        ,table1.*
        ,table2.*
        ,table3.*', FALSE)
     ->from('table1')
     ->where('table1.column1', $user_id)
     ->join('table2', 'table2.column2 = table1.column2')
     ->join('table3', 'table3.column2 = table1.column2')
     ->group_by('table1.column2')
     ->order_by('table1.column2', 'DESC');

 $query = $this->db->get();

The problem is, there may not be a row in table 3 and if there is not, I would still like to return a result with the remainder of the query data. Please could someone advise how to achieve this?

A: you should do a left join on table3

A: Use left join and also use group_by to get exact records:
$this->db->join('login_ranknames AS t4', 't4.id = t1.rank', 'left');
$this->db->group_by('t4.id');

