$q = $this->db->select(\' books.title, reserved_books.id, reserved_books.isbn, reserved_books.price,
Try Below:
$this->db->distinct();
but Distinct will not always work. You should add ->group_by("name_of_the_column_which_needs_to_be unique");
>group_by("name_of_the_column_which_needs_to_be unique");
$this->db->group_by('column_name');