I have a SELECT which is returning me data in the following form...
ID Question Answer
1 Any Good? Yes
1
Have you tried something like
SELECT *
FROM (
SELECT ID,
Question,
Answer
FROM @Table1
) t
PIVOT (MAX(Answer) FOR Question IN ([Any Good?],[Happy?],[Good Staff?],[Return?])) p
The pivot operation requires you to use some form of aggregate, however if you will only have one value Max()
will grab the max (only) value for you
Something Like this should work
Select *
from Table
Pivot
(
Max(answer)
For Question In ([Any Good?],[Happy?],[Good Staff?],[Return?])
)
AS P