Last active
December 16, 2015 18:59
-
-
Save mikebuchanon/5481593 to your computer and use it in GitHub Desktop.
query to get all Likert survey results for a student 'survey' from all courses in a given Moodle category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select mc.shortname, mqq.content "question", | |
sum(case when mqqc.content = 'Strongly Disagree' then 1 else 0 end) "Strongly Disagree", | |
sum(case when mqqc.content = 'Disagree' then 1 else 0 end) "Disagree", | |
sum(case when mqqc.content = 'Neutral' then 1 else 0 end) "Neutral", | |
sum(case when mqqc.content = 'Agree' then 1 else 0 end) "Agree", | |
sum(case when mqqc.content = 'Strongly Agree' then 1 else 0 end) "Strongly Agree", | |
count(mqqc.content) "Total" | |
from mdl_course mc | |
join mdl_questionnaire mq on mq.course=mc.id | |
join mdl_questionnaire_question mqq on mqq.survey_id=mq.id and mqq.deleted = 'n' and mqq.type_id=4 | |
join mdl_questionnaire_resp_single mqrs on mqrs.question_id=mqq.id | |
join mdl_questionnaire_quest_choice mqqc on mqqc.id = mqrs.choice_id | |
where mc.category=35 and mq.name ilike '%survey%' | |
group by mc.shortname, mq.name, mqq.content | |
order by mc.shortname, mqq.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment