0
Do it to the guys! In the Moodle, in the database, in a quiz activity, where I find the record table of answers given by students in a given questionnaire?
I am doing so, where in the lastname field, is where I put a code for school and in the use Institution field to put school name, is the logical reasoning correct? rsrs:
SELECT
SUBSTRING(u.`department`,2,5) AS Turma,
u.`firstname` AS Aluno,
u.`lastname` AS Siem,
u.`institution` AS Escola,
i.`itemname` AS Simulado,
g.`finalgrade` AS Nota,
(select count(u.`firstname`)
from `mdl_grade_items` i INNER JOIN `mdl_grade_grades` g ON i.`id` = g.`itemid` INNER JOIN `mdl_user` u ON g.`userid` = u.`id`
where itemid = 6 and courseid = 2 and lastname = 213 AND finalgrade != "NULL") totalAlunos,
(select avg(finalgrade)
from `mdl_grade_items` i INNER JOIN `mdl_grade_grades` g ON i.`id` = g.`itemid` INNER JOIN `mdl_user` u ON g.`userid` = u.`id`
where itemid = 6 and courseid = 2 and lastname = 213 and department = ".5anoA") notaTurmaA,
(select avg(finalgrade)
from `mdl_grade_items` i INNER JOIN `mdl_grade_grades` g ON i.`id` = g.`itemid` INNER JOIN `mdl_user` u ON g.`userid` = u.`id`
where itemid = 6 and courseid = 2 and lastname = 213 and department = ".5anoB") notaTurmaB,
(select avg(finalgrade)
from `mdl_grade_items` i INNER JOIN `mdl_grade_grades` g ON i.`id` = g.`itemid` INNER JOIN `mdl_user` u ON g.`userid` = u.`id`
where itemid = 6 and courseid = 2 and lastname = 213) as NotaGeralEscola
FROM
`mdl_grade_items` i INNER JOIN `mdl_grade_grades` g ON i.`id` = g.`itemid`
INNER JOIN `mdl_user` u ON g.`userid` = u.`id`
WHERE
i.courseid = 2 AND itemtype = "mod" AND itemmodule = "quiz" AND finalgrade != "NULL" AND g.`itemid` = 6
ORDER BY
u.`department` ASC, finalgrade desc