I have a SELECT which is returning me data in the following form...
ID Question Answer
1 Any Good? Yes
1 Happy? No
1 Good Staff? Yes
1 Return? N/A
2 Any Good? No
2 Happy? No
2 Good Staff? Yes
2 Return N/A
...
I need this in the following form...
ID Any Good? Happy? Good Staff? Return?
1 Yes No Yes N/A
2 No No Yes N/A
...
The 'Answer' column in my top query is computed using a CASE .. WHEN
. I was thinking maybe the PIVOT
clause could help me. This seems to require aggregation though. I don't need to aggregate, just transpose.
I don't mind having to specify each Answer
explicitly in the solution (I'm guessing I'll have to do that anyway).
Anyone know the best way of doing this?