I hope I can describe this well enough for you to get what I need. I have a table with questionnaire responses, columns are:
cust_id
question_number
response
datetimestamp
So my table looks like this:
cust_id | question_no | response |
---|---|---|
1234 | 1 | YES |
1234 | 2 | NO |
1234 | 3 | TAKEN |
1234 | 4 | NOT GIVEN |
4567 | 1 | NO |
4567 | 3 | NOT TAKEN |
8888 | 2 | YES |
8888 | 4 | GIVEN |
basically i need a query which will give me each cust_id and each question and response - like this:
cust_id | question_1 | response_1 | question_2 | response_2 | question_3 | response_3 | question_4 | response_4 |
---|---|---|---|---|---|---|---|---|
1234 | 1 | YES | 2 | NO | 3 | taken | 4 | not given |
4567 | 1 | NO | 3 | NOT TAKEN | ||||
8888 | 2 | YES | 4 | GIVEN |