Q&A for professional and enthusiast programmers
DECLARE @UserId int = ##UserId## SELECT Count(*) AS [All], Sum(CASE WHEN a.Score > 0 THEN 1 ELSE 0 END) AS [Upvoted], Sum(CASE WHEN a.Score = 0 THEN 1 ELSE 0 END) AS [Zero Voted], Sum(CASE WHEN a.Score < 0 THEN 1 ELSE 0 END) AS [Downvoted] FROM Posts a LEFT JOIN Posts q ON q.AcceptedAnswerId = a.Id WHERE a.OwnerUserId = @UserID AND a.PostTypeId = 1