I flagged this answer as Not An Answer (NAA), because while this does point the OP in the direction of the correct answer, the answer as written should be a comment.
In the event the answer gets deleted, the content of it is:
You need to construct a query with a PIVOT.
This answer is a link-only answer to the MSDN documentation.
My flag was declined with the reason:
declined - flags should not be used to indicate technical inaccuracies, or an altogether wrong answer
I am curious as to why this was declined, considering this is a comment, should it have been flagged with other instead of not an answer?