Skip to content

Instantly share code, notes, and snippets.

@mikebuchanon
Created August 15, 2014 13:55
Show Gist options
  • Save mikebuchanon/466bac24c2378b21860c to your computer and use it in GitHub Desktop.
Save mikebuchanon/466bac24c2378b21860c to your computer and use it in GitHub Desktop.
Query to find ANGEL survey results based on course and survey title
select le.COURSE_ID, a.LoginName, qdq.sequence [question_number],
replace(replace(replace(replace(cast(qq.question_text as nvarchar(max)),'<div>',''),'</div>',''),'<b>',''),'</b>','') [question_text],
case when qpa.value = '1' then 'Strongly Agree'
when qpa.value = '2' then 'Agree'
when qpa.value = '3' then 'Neutral'
when qpa.value = '4' then 'Disagree'
when qpa.value = '5' then 'Strongly Disagree'
else qpa.value
end as [response],
qpa.lastModified [last_modified]
from qti_question_containers qqc (nolock)
join LSN_ENTRIES le (nolock) on le.ENTRY_ID=qqc.entry_ID
join qti_assessment_attempt qaa (nolock) on qaa.question_container_id=qqc.id
join ACCOUNTS a (nolock) on a.PERSON_ID=qaa.person_id
join qti_delivered_questions qdq (nolock) on qdq.attempt_id=qaa.attempt_id
join qti_persisted_answers qpa (nolock) on qpa.delivered_id=qdq.delivered_id
join qti_questions qq (nolock) on qq.question_id=qdq.question_id
where le.COURSE_ID='course_id'
and qqc.title='survey title'
order by le.COURSE_ID, a.LoginName, qdq.sequence asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment