PIVOT queries is a very powerful tool in SQL Server. But who can really
remember the crazy format that the query needs to be in to get the query
to parse correctly. PIVOT Generator is here to help enter your query and
complete a few simple steps and you'll have a working PIVOT statement. Enjoy.
FROM Posts p
JOIN Votes v ON p.Id = v.PostId
JOIN VoteTypes vt ON v.VoteTypeId = vt.Id
WHERE p.Id = 9