MDL-63724 messaging: Prefix field with the table alias
[moodle.git] / lib / classes / message / manager.php
index 5630ac4..4ffc62e 100644 (file)
@@ -86,7 +86,7 @@ class manager {
                   FROM {message_conversation_members} mcm
                   JOIN {user} u
                     ON (mcm.conversationid = :convid AND u.id = mcm.userid)
-              ORDER BY id desc";
+              ORDER BY u.id desc";
         $members = $DB->get_records_sql($sql, ['convid' => $eventdata->convid]);
         if (empty($members)) {
             throw new \moodle_exception("Conversation has no members or does not exist.");