From: jamiesensei Date: Tue, 22 Jul 2008 13:06:54 +0000 (+0000) Subject: MDL-15198 "non-standard sql in reportlib.php" similar sql used here, fixing. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a1db71cb25daa135c4f6210ec2d3a4ea0e89f2e4;p=moodle.git MDL-15198 "non-standard sql in reportlib.php" similar sql used here, fixing. --- diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index a86712062d..47bab7f920 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -115,7 +115,7 @@ class quiz_statistics_report extends quiz_default_report { $whereqa .= ' AND qa.userid '.$grpsql.' '; $qaparams += $grpparams; } - $sql = 'SELECT (attempt=1) AS isfirst, COUNT(1) AS countrecs, SUM(sumgrades) AS total ' . + $sql = 'SELECT (CASE WHEN attempt=1 THEN 1 ELSE 0 END) AS isfirst, COUNT(1) AS countrecs, SUM(sumgrades) AS total ' . 'FROM '.$fromqa. 'WHERE ' .$whereqa. 'GROUP BY (attempt=1)';