datatables->select('users.id, username, first_name, last_name, email, FROM_UNIXTIME(created_on) as created_on, last_login, active, groups.name as level'); $this->datatables->from('users_groups'); $this->datatables->join('users', 'users_groups.user_id=users.id'); $this->datatables->join('groups', 'users_groups.group_id=groups.id'); if($id !== null){ $this->datatables->where('users.id !=', $id); } return $this->datatables->generate(); } }