Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT q.id, (SELECT COUNT(1)
- FROM m_quiz_attempts quiza
- JOIN m_question_attempts qa ON qa.questionusageid = quiza.uniqueid
- WHERE qa.questionid = q.id AND quiza.quiz = :o_quizaquiz AND quiza.userid = :o_userid AND preview = 0 AND state IN (:o_state1, :o_state2)
- ) AS previous_attempts
- FROM m_question q JOIN m_question_versions qv ON qv.questionid = q.id
- JOIN m_question_bank_entries qbe ON qbe.id = qv.questionbankentryid
- WHERE qbe.questioncategoryid IN (:o_qc12,:o_qc13)
- AND q.parent = 0
- AND qv.status = 'ready'
- AND qv.version = (SELECT MAX(v.version)
- FROM m_question_versions v
- JOIN m_question_bank_entries be
- ON be.id = v.questionbankentryid
- WHERE be.id = qbe.id) AND q.id IN (SELECT ti.itemid
- FROM m_tag_instance ti
- WHERE ti.itemtype = :o_questionitemtype
- AND ti.component = :o_questioncomponent
- AND ti.tagid = :o_ti14
- GROUP BY ti.itemid
- HAVING COUNT(itemid) = :o_tagcount) AND (q.qtype NOT IN (:o_excludedqtype8,:o_excludedqtype9,:o_excludedqtype10,:o_excludedqtype11))
- ORDER BY previous_attempts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement