]> git.mjollnir.org Git - moodle.git/commitdiff
ANSI join ON clauses should contain only the join condition. Also,
authorstronk7 <stronk7>
Mon, 8 Oct 2007 17:42:46 +0000 (17:42 +0000)
committerstronk7 <stronk7>
Mon, 8 Oct 2007 17:42:46 +0000 (17:42 +0000)
added prefix to the ORDER BY to prevent duplicate names.

lib/datalib.php

index 46ecc03057ad3709bff1f468110335173cf3fe61..fb84762ac4839086453e40e9a347ae7d1eccb8a8 100644 (file)
@@ -907,10 +907,10 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
         $sql = "SELECT cc.id, cc.path, cc.visible,
                        ctx.id AS ctxid, ctx.path AS ctxpath,
                        ctx.depth as ctxdepth, ctx.contextlevel AS ctxlevel
-                FROM {$CFG->prefix}course_categories cc
-            JOIN {$CFG->prefix}context ctx
-              ON (cc.id=ctx.instanceid AND ctx.contextlevel=".CONTEXT_COURSECAT.")
-                ORDER BY id";
+                 FROM {$CFG->prefix}course_categories cc
+                 JOIN {$CFG->prefix}context ctx ON (cc.id = ctx.instanceid)
+                WHERE ctx.contextlevel = ".CONTEXT_COURSECAT."
+             ORDER BY cc.id";
         $rs = get_recordset_sql($sql);
 
         // Using a temporary array instead of $cats here, to avoid a "true" result when isnull($cats) further down