Creating a SQL Report Tutorial

Creating a SQL Report Tutorial

by Elliot C -
Number of replies: 0

I get a database error when I execute a SQL query from the "Creating a SQL Report" in the Configurable Reports tutorial. This problem may be an easy fix but for my experience I'm unsure how to fix it.

 

Moodle 2.5.1+

Tim's Ad-hoc plugin is installed along with the configurable Reports block.

 

I'm following the directions in the "Creating a SQL Report" tutorial here (it's almost half way down the page): http://docs.moodle.org/26/en/blocks/configurable_reports/

When I copy/paste the query below I get a database error:

SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id
GROUP BY courseId
ORDER BY hits DESC

 

The debug info reads:

Debug info: SQLState: 42S22<br>
Error Code: 207<br>
Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid column name 'courseId'.<br>

SELECT TOP 2 COUNT(l.id) hits, l.course courseId, c.fullname coursename 
FROM mdl_log l INNER JOIN mdl_course c ON l.course = c.id 
GROUP BY courseId 
ORDER BY hits DESC
[array (
)] 
Error code: dmlreadexception

 

Average of ratings: -