Q&A for scientists using computers to solve scientific problems
SELECT p.Id AS [Post Link], SUM(CASE f.VoteTypeId WHEN 2 THEN 1 WHEN 3 THEN -1 ELSE 0 END) AS [Feedback Score], SUM(CASE WHEN f.VoteTypeId = 2 THEN 1 ELSE 0 END) AS Helpful, SUM(CASE WHEN f.VoteTypeId = 3 THEN 1 ELSE 0 END) AS Unhelpful, p.Score AS [Actual Score] FROM Posts p JOIN PostFeedback f ON f.PostId = p.Id WHERE p.Id = ##PostId:int## GROUP BY p.Id, p.Score