Using filters in the SQL report

Using filters in the SQL report

by Alex Ferrer -
Number of replies: 2

Hi there.

I am using the latest version of the plugin on a Moodle 3.5.10

I have created an SQL query to get the certificates of the students, and I have applied 2 filters (by course and last name), but these do not work.

I don't know if you have to add something to the query to make them work, here is the query that I used.

SELECT u.firstname AS "Nombre", u.lastname AS "Apellidos", u.email AS "email", c.fullname AS "Curso", l.code AS "Codigo", DATE_FORMAT( FROM_UNIXTIME( l.timecreated ), '%d/%m/%Y, a las %h:%i' ) AS "Fecha de emision"
FROM prefix_customcert_issues l
JOIN prefix_user u ON l.userid = u.id
JOIN prefix_customcert t ON l.customcertid = t.id
JOIN prefix_course c ON t.course = c.id
ORDER BY u.lastname, c.fullname

Any help will be well received.

Thanks!

Average of ratings: -
In reply to Alex Ferrer

Re: Using filters in the SQL report

by Alex Ferrer -
Solved!

In the line JOIN prefix_course c ON t.course = c.id I needed to add WHERE 1 = 1 %% FILTER_COURSES: c.id %% for the filter to be effective.

Regards!
Average of ratings: Useful (1)