CodeIgniter ActiveRecord field names in JOIN statement
If you want to select some specific columns from table use db->select()
. You can give alias to tables, add some conditions and etc. Send second parameter FALSE
to not escape special characters.
$this->db->select('u.id, u.username, c.name', false);
$this->db->from('user as u');
$this->db->join('companies as c', 'u.company_id = c.id');
$this->db->where('LOWER(u.username)=', strtolower('foobar'));
$query = $this->db->get();