Q&A for professional and enthusiast programmers
DECLARE @UserId int = ##UserId##; SELECT COUNT(DISTINCT Answers.Id) AS Answers, SUM(Answers.Score) AS Votes, SUM(Votes.BountyAmount) AS Bounty FROM Posts AS Answers LEFT JOIN Votes ON (Answers.Id = Votes.PostId) WHERE Answers.OwnerUserId = @UserId AND Answers.PostTypeId = 2;