mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-50583 upgrade: Optimize upgrade_minmaxgrade
Reverse join order to use existing database keys. Changed query to use the more easily read NOT IN.
This commit is contained in:
parent
f1a415ea70
commit
82cca1ab16
@ -2303,10 +2303,10 @@ function upgrade_minmaxgrade() {
|
||||
|
||||
// Identify the courses that have inconsistencies grade_item vs grade_grade.
|
||||
$sql = "SELECT DISTINCT(gi.courseid)
|
||||
FROM {grade_items} gi
|
||||
JOIN {grade_grades} gg
|
||||
FROM {grade_grades} gg
|
||||
JOIN {grade_items} gi
|
||||
ON gg.itemid = gi.id
|
||||
WHERE (gi.itemtype != ? AND gi.itemtype != ?)
|
||||
WHERE gi.itemtype NOT IN (?, ?)
|
||||
AND (gg.rawgrademax != gi.grademax OR gg.rawgrademin != gi.grademin)";
|
||||
|
||||
$rs = $DB->get_recordset_sql($sql, array('course', 'category'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user