Permalink
Browse files

MDL-43946 gradebook upgrade Improve SQL to find duplicate sortorders.

  • Loading branch information...
1 parent 4f6e4f8 commit e29585b206feff5c166e096a124beb7ce807e54a @merrill-oakland merrill-oakland committed Feb 5, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/upgradelib.php
View
@@ -2064,7 +2064,7 @@ function upgrade_grade_item_fix_sortorder() {
$transaction = $DB->start_delegated_transaction();
- $sql = "SELECT g1.id, g1.courseid, g1.sortorder
+ $sql = "SELECT DISTINCT g1.id, g1.courseid, g1.sortorder
FROM {grade_items} g1
JOIN {grade_items} g2 ON g1.courseid = g2.courseid
WHERE g1.sortorder = g2.sortorder AND g1.id != g2.id

0 comments on commit e29585b

Please sign in to comment.