Mysql-запрос,
SELECT qcat.name,
COUNT( CASE WHEN qas.state = "todo" THEN 1 END ) AS gtotal,
COUNT( CASE WHEN qas.state = "gradedright" THEN 1 END ) AS rightanswer,
COUNT( CASE WHEN qas.state = "gradedwrong" THEN 1 END ) AS wronganswer,
SUM(qas.fraction) AS grade,
quiza.id
FROM mdl_quiz_attempts quiza
JOIN mdl_question_attempts qa ON qa.questionusageid = quiza.uniqueid
JOIN mdl_question_attempt_steps qas ON qas.questionattemptid = qa.id
JOIN mdl_question qstn ON ( qa.`questionid` = qstn.id )
JOIN mdl_question_categories qcat ON ( qstn.`category` = qcat.id )
WHERE quiza.id=1173 and FIND_IN_SET(qstn.id, (1,2,3,4,5,6)) GROUP BY quiza.id,qcat.name
с ошибкой: # 1241 - операнд должен содержать 1 столбец (ов)