I want to create a report that shows the questions that are most frequently answered incorrectly.

I tried adding the field Quiz Results by Question: Is Correct but it generates an error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'quiz_node_results.result_id' in 'on clause'

Any one have any idea how I would get these statistics?


jlongbottom’s picture

I went ahead and just made a module to do it. Judging by the issue queue, my question was not going to get answered soon or ever.

Anyways, here is the query to do it in case anyone in the future is reading this:

SELECT `question_nid`, count(*) as count, `title`, `type`
FROM {quiz_node_results_answers} answer
INNER JOIN {node} n ON {answer.question_nid = n.nid}
WHERE answer.is_correct = 0
GROUP BY `question_nid`
ORDER BY count(*) DESC
JCL324’s picture

I'm having the same issue with 4.0-beta1 and was apparently somewhat fixed in https://drupal.org/node/1459358 but not for this (our) case. I need the same type of report, mind sharing how you did it in your module? Did you still use a View but just do a hook_query_alter in the module? If not, how did you display the output of the query?

Also, I added a HAVING count(*) > 2 to limit the results instead of the LIMIT to show all questions that had more than 1 wrong answer.

JCL324’s picture

Issue summary: View changes

moved error message into CODE tag

djdevin’s picture

Component: Code - other » Code - Quiz core
Issue summary: View changes
Status: Active » Closed (outdated)

This issue is being closed because it was filed against a version that is no longer supported. If the issue still persists in the latest version of Quiz, please open a new issue.