I have a table with the following columns:
SubjectID
instanceID
pagenumber
sectionnumber
subsectionnumber
recordindex
columnnumber
controlnumber
controlname
answervalue
This will have multiple rows per subjectID and InstanceID, but unique for the full combination above.
I want to pivot this table, so that it generates one row per SubjectID, InstanceID combination, and creates a column for each Pagenumber, sectionnumber, subsectionnumber,recordindex,columnnumber,controlnumber,controlname combination, with answer value as the value.
for ex
SubjectID 1 1
instanceID 1 1
pagenumber 1 1
sectionnumber 1 1
subsectionnumber 1 1
recordindex 1 1
columnnumber 1 1
controlnumber 1 2
controlname Whatisyourname howoldareyou
answervalue Sam 20
becomes
subjectid 1
instanceid 1
111111whatisyourname Sam
111112howoldareyou 20
Any help would be appreciated!
I am yet to try anything!
Sam.Hirshman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.