I have the following MySql query, the results are shown as in the image below, I would like to not repeat the values of the Aluno
and NotaGeral
columns based on the Usuario
column which is a single value. do not just ask not to repeat Alunos
or NotaGeral
values as there may be equal scores of different users and student names alike but being different users. Any suggestions?
select avg(IFNULL(fraction, 0))*10 as Media, gg.finalgrade as NotaGeral, u.firstname as Aluno, u.username as Usuario, u.lastname as siem, qas.userid, u.department as Turma, u.institution as Escola, qc.name as cat
FROM mdl_question_attempt_steps qas
inner join mdl_user u on u.id=qas.userid
INNER JOIN mdl_question_attempts qa ON qa.id=qas.questionattemptid
INNER JOIN mdl_question q On q.id=qa.questionid
inner join mdl_grade_grades gg on gg.userid=u.id
INNER JOIN mdl_grade_items gi ON gi.'id' = gg.'itemid'
INNER JOIN mdl_quiz_slots qs ON qs.questionid=qa.questionid
Inner Join mdl_quiz quiz ON quiz.id=qs.quizid
inner join mdl_question_categories qc ON qc.id=q.category
where substring(u.department,2,1) = 4
AND itemtype = "mod"
AND itemmodule = "quiz"
AND finalgrade != "NULL"
and substr(quiz.name,-1)=1
and substr(quiz.ano,1,4)=2018
and u.lastname=213
and qas.state!="todo"
and qas.state!="complete"
group by turma, q.category, u.id
ORDER BY turma ASC, 'Aluno' ASC, cat DESC