- Downloaded the ad-hoc contributed reports plugin
- Added 2.6.2 Site-Wide Grade Report with Just Course Totals query
- Tested and ran a successful query with the Query SQL listed in Moodle Docs
- I tried looking up the MySQL code for a date range in Moodle Docs, was unsuccessful
- Searched: dev.mysql.com/doc/ , stackoverflow , and github , but I didn't understand as I'm not a coder
The code I found that seems like it would perform the function I am looking for is:
BETWEEN DATE_FORMAT(NOW() - INTERVAL 1 MONTH, '%Y-%m-01 00:00:00') AND DATE_FORMAT(LAST_DAY(NOW() - INTERVAL 1 MONTH), '%Y-%m-%d 23:59:59')
But I don' know if that is the right instruction or format or anything.
What could I add to the listed code that would just have the totals for the specific date range I mentioned?
SELECT u.firstname AS 'First' , u.lastname AS 'Last', u.firstname + ' ' + u.lastname AS 'Display Name', cc.name AS 'Category', CASE WHEN gi.itemtype = 'course' THEN c.fullname + ' Course Total' ELSE gi.itemname END AS 'Item Name', ROUND(gg.finalgrade,2) AS Grade, DATEADD(ss,gg.timemodified,'1970-01-01') AS Time FROM prefix_course AS c JOIN prefix_context AS ctx ON c.id = ctx.instanceid JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id JOIN prefix_user AS u ON u.id = ra.userid JOIN prefix_grade_grades AS gg ON gg.userid = u.id JOIN prefix_grade_items AS gi ON gi.id = gg.itemid JOIN prefix_course_categories as cc ON cc.id = c.category WHERE gi.courseid = c.id AND gi.itemtype = 'course' ORDER BY lastname
Thanks!