I have a table like:
Survey Result
SurveyId Int ex. 12
QuestionName Varchar ex. A18a
QuestionValue Int ex. 2
I am trying to write a query that would set the values of QuestionName as columns horizontally, by SurveyId. If there is no entry for a certain question, that value would read NULL. The result would look like:
SurveyId | A01 | A02 | A03 | A04...
12 | 1 | 4 | 3 | NULL...
213 | 2 | 5 | NULL | NULL ...
I can't figure out how to select the questions as column titles. Is there an easy way of accomplishing this? Any help would be appreciated.