Group by ID and Order by date
问题 $lastComments = $this->Comment->find('all', array('fields' => array('Comment.news_id', 'Comment.date', 'Comment.content'), 'group' => array('Comment.news_id, Comment.date'), 'order' => array('Comment.date DESC')) ); The idea is to get latest comment from unique topics (1 comment - 1 topic). This code doesn't handle unique ID's (unique topics), how Can I fix that? Distinct doesn't work. $lastComments = $this->Comment->find('all', array('fields' => array('Comment.news_id', 'Comment.date',