[eluser]Jacob156[/eluser]
I was unable to change results with Distinct.
I have changed to the following which returns the proper Member.* and History.ID but not the proper History.Note. It returns one of the other notes for the user.
Code:
$this->db->select_max('History.ID','hcid');
$this->db->select('Member.ID, Member.*, History.Note');
$this->db->join('History','Member.ID = History.CustomerID','left');
$this->db->where('Member.StatusCodeID',$sc_id);
$this->db->order_by("History.CreatedDate", "desc");
$this->db->group_by("History.CustomerID");
$results = $this->db->get('Member');
Is there any way to do this in SQL without having to loop through the results and pull the last History entry?
All I need to do is go through the members with a given status and pull the most recent history entry.
Thanks
Jacob