diff --git a/mod/lesson/db/upgrade.php b/mod/lesson/db/upgrade.php index 8a2540e8e33..a3e57608919 100644 --- a/mod/lesson/db/upgrade.php +++ b/mod/lesson/db/upgrade.php @@ -419,7 +419,7 @@ function xmldb_lesson_upgrade($oldversion) { if ($oldversion < 2017051501) { // Delete orphaned lesson answer and response files. - $sql = "SELECT DISTINCT f.* + $sql = "SELECT DISTINCT f.contextid, f.component, f.filearea, f.itemid FROM {files} f LEFT JOIN {lesson_answers} la ON f.itemid = la.id WHERE component = :component