$options = array('order' => array('MemberMessage.send_date_time' => 'desc'),
  'fields' => array('MemberMessage.id','MemberMessage.message'),
  'group' => 'MemberMessage.message_reciever_id');

 $this->MemberMessage->recursive = 0;
 $MemberMessages = $this->MemberMessage->find('all',$options);

最佳答案

我认为这应该足够了吗?

$lastMessage = $this->Message->find('first', array(
    'order' => array('Message.created' => 'desc')
));


祝好运!

关于mysql - 我如何在cakephp中获取用户与其他所有用户的最新消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22318771/

10-12 16:25