MDL-63724 messaging: Prefix field with the table alias
authorDavid Monllao <davidm@moodle.com>
Mon, 12 Nov 2018 15:26:14 +0000 (16:26 +0100)
committerDavid Monllao <davidm@moodle.com>
Mon, 12 Nov 2018 15:26:14 +0000 (16:26 +0100)
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.");