I'm updating a Flash based front end so that it will work with the Quiz module (6.x - 4.0) that works with the Quiz, Services, AMFPHP, and custom modules.
I'm struggling with some of the queries within my custom module that pull the questions and answers from the Quiz tables. I'm trying to make sure I've got the latest VID for each Question and Answer.
Here is the query:
SELECT quiz_node_relationship.parent_nid,
quiz_multichoice_answers.answer,
quiz_multichoice_answers.question_nid,
MAX(quiz_multichoice_answers.question_vid) AS MAX_question_vid,
quiz_multichoice_answers.score_if_chosen
FROM quiz_node_relationship RIGHT OUTER JOIN quiz_multichoice_answers ON quiz_node_relationship.child_nid = quiz_multichoice_answers.question_nid
WHERE quiz_node_relationship.parent_nid = '23'
GROUP BY quiz_node_relationship.parent_nid, quiz_multichoice_answers.answer, quiz_multichoice_answers.question_nid, quiz_multichoice_answers.score_if_chosen
ORDER BY quiz_multichoice_answers.question_nid ASC, MAX_question_vid DESC
I'd like to have the results show only the records with the highest question_vid for a given question_nid.
I've attached the results of this query.
| Attachment | Size |
|---|---|
| result.jpg | 76.58 KB |