Accepted Answer Statistics

0

Please login or register to vote for this query.

(click on this box to dismiss)

Webmasters

Q&A for pro webmasters

-- Answer Accepted Statistics

DECLARE @UserId int = ##UserId##

SELECT
 Count(*) AS [Accepted Answers],
 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
  INNER JOIN 
   Posts q
    ON q.AcceptedAnswerId = a.Id
WHERE
 a.OwnerUserId = @UserID AND
 a.PostTypeId = 2

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results