Q&A for professional and enthusiast programmers
SELECT TOP 100 SUM(CASE WHEN f.VoteTypeId = 2 THEN 1 ELSE -1 END) AS 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, f.PostId AS [Post Link], p.OwnerUserId AS [User Link] FROM PostFeedback f INNER JOIN Posts p ON p.Id = f.PostId WHERE f.VoteTypeId IN (2, 3) GROUP BY f.PostId, p.OwnerUserId ORDER BY Score DESC