Use o método de consulta do CodeIgniter e passe qualquer consulta sql complexa por meio de:
$query = $this->db->query("SELECT * FROM dbname1.table t1 JOIN db2.table t2 ON t2.column = t1.column");
foreach ($query->result() as $row)
{
print_r($row);
}