From 3b6fcd1f5bd6fb635c7b5709f7a13bf31692ad7c Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 1 Aug 2023 12:46:18 +0100 Subject: [PATCH] MDL-78575 mod_lti: remove column alias from inner sub-select. The `usage` alias is a reserved word in MySQL/MariaDB. --- .../local/systemreports/course_external_tools_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/lti/classes/reportbuilder/local/systemreports/course_external_tools_list.php b/mod/lti/classes/reportbuilder/local/systemreports/course_external_tools_list.php index 9d574cf9e57..7e8b46970c8 100644 --- a/mod/lti/classes/reportbuilder/local/systemreports/course_external_tools_list.php +++ b/mod/lti/classes/reportbuilder/local/systemreports/course_external_tools_list.php @@ -99,7 +99,7 @@ class course_external_tools_list extends system_report { // Tool usage column using a custom SQL subquery to count tool instances within the course. // TODO: This should be replaced with proper column aggregation once that's added to system_report instances in MDL-76392. $ti = database::generate_param_name(); // Tool instance param. - $sql = "(SELECT count($ti.id) as usage + $sql = "(SELECT COUNT($ti.id) FROM {lti} $ti WHERE $ti.typeid = {$entitymainalias}.id)"; $this->add_column(new column(