Permalink
Browse files

Close Bug #5670 - get_courses_page() - remove costly and redundant DI…

…STINCT

get_courses_page() uses get_records_sql() which means that it will actually
break if the first field requested isn't c.id. This in turn means that
the DISTINCT is not needed at all.

So let's go fast again!
  • Loading branch information...
1 parent 059366f commit 8a774fddb7430e88476bc775d180146da5da0711 martinlanghoff committed Jul 18, 2006
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/datalib.php
View
@@ -2185,7 +2185,7 @@ function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c
$totalcount = count_records_sql("SELECT COUNT(DISTINCT c.id) FROM $selectsql");
- return get_records_sql("SELECT DISTINCT $fields FROM $selectsql ".((!empty($sort)) ? "ORDER BY $sort" : "")." $limit");
+ return get_records_sql("SELECT $fields FROM $selectsql ".((!empty($sort)) ? "ORDER BY $sort" : "")." $limit");
}

0 comments on commit 8a774fd

Please sign in to comment.