Segue o comando SQL que gera o relatório sobre discussão no fórum do MReport. Você pode capturar esse comando ativando o log de consulta do banco de dados.
SELECT DISTINCT p.id,p.created AS timecreated,p.subject,p.message,p.mailnow,d.id AS discussionid,f.id AS forumid,f.name AS forumname, u.id AS userid,u.firstname, u.lastname,u.email,r.name AS rolename,r.shortname AS roleshortname,c.id AS courseid,c.fullname AS coursename,ct.name AS coursecatname, ct.id coursecatid FROM mdl_forum_posts p INNER JOIN mdl_user u ON p.userid=u.id INNER JOIN mdl_forum_discussions d ON d.id=p.discussion INNER JOIN mdl_forum f ON f.id =d.forum INNER JOIN mdl_course c ON c.id=f.course INNER JOIN mdl_course_categories ct ON c.category=ct.id INNER JOIN mdl_role_assignments rs ON rs.userid=p.userid INNER JOIN mdl_role r ON rs.roleid=r.id INNER JOIN mdl_context e ON rs.contextid=e.id INNER JOIN mdl_enrol en ON e.instanceid=en.courseid INNER JOIN mdl_user_enrolments ue ON en.id=ue.enrolid WHERE e.contextlevel=50 AND e.instanceid=f.course AND u.id=ue.userid AND p.created >= ? AND p.created <= ? AND (ue.timestart IS NULL OR ue.timestart = 0 OR ue.timestart <= ? ) AND (ue.timeend IS NULL OR ue.timeend = 0 OR ue.timeend >= ? ) AND u.confirmed = 1 AND u.deleted = 0 AND u.suspended = 0 AND c.visible= 1 AND c.startdate >= ? AND c.startdate <= ? AND ue.status = 0 AND en.status = 0 ORDER BY p.created DESC
No SQL, os vários dinâmicos foram alterado para ? Você deve passar esses parâmetros antes de rodas na base de dados.