Add MySQL Subquery

0

I have the following query to get% Note% as_% as I can in the same query get the% Note% with% I'm trying so, but I get the same value for NotePT and NoteMT, below code and output image:

select u.firstname as Aluno, u.lastname as escola, userid, u.department as turma, q.category as cat,


(select avg(fraction)*10 where cat = 3) as NotaPT,

(select avg(fraction)*10 where cat = 11) as NotaMT


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

group by userid, turma
order by turma asc, NotaPT DESC

    
asked by anonymous 13.03.2018 / 15:30

0 answers