I have a sql query which returns a list of students which are enrolled in a conference, and their preferences for each session. When pulling the data from my database, each user session selection is showing in its own row as shown below:
**userid question answer**
1 S1 choose: a1, b1, c1 a1
1 S2 choose: a2, b2, c2 b2
1 S3 choose: a3, b3, c3 b3
2 S1 choose: a1, b1, c1 b1
2 S2 choose: a2, b2, c2 c2
2 S3 choose: a3, b3, c3 a3
3 S1 choose: a1, b1, c1 a1
3 S2 choose: a2, b2, c2 b2
3 S3 choose: a3, b3, c3 b3
I would like to make each session a colum, so that each userid with the questions and answers is shown in one row. Like so:
user1 question1 answer1 question2 answer2 question3 answer3
user2 question1 answer1 question2 answer2 question3 answer3
user3 question1 answer1 question2 answer2 question3 answer3
I'm limited to my SQL query knowledge so I would greatly appreciate your help....how can I reach the above results? Thanks in advance