[eluser]sszynrae[/eluser]
Hoping someone here might give me some help, this resulted in a very unproductive saturday night
Basically I have a typical comments db with commentid, id (of the post it's linked to) etc.
I want to get the latest comments, but list only one from each id.
The problem is that once you group by id the the elements inside the group ignore sort by date as I can only get the first comment from each post.
This is my current query.
Code:
$this->db->select('date,name,id,cid');
$this->db->group_by('id');
$this->db->orderby('date', "desc");
$output = $this->db->get('comments', $limit);
Any ideas? I've tried loads of different variants but none seem to work.