Answers - number and percentage of accepted answers

1

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

; with answerersaccepted_cte AS
(SELECT 
  a.OwnerUserId AS uid, 
  a.OwnerDisplayName AS udn,
  COUNT(a.Id) AS ACount,
  SUM(CASE WHEN q.AcceptedAnswerId=a.Id then 1 else 0 end) AS AccCount
  FROM Posts a JOIN Posts q ON a.ParentId=q.Id
  GROUP BY a.OwnerUserId, a.OwnerDisplayName
 )
 
SELECT TOP(##num?500##)
  uid AS [User Link],
  udn AS [Display Name],
  AccCount AS [Accepted Answers],
  ACount AS [All Answers],
  ROUND(AccCount*100.0/ACount,2) AS percentage
FROM answerersaccepted_cte  
WHERE (ACount>=##min?10##)
--restrict to users with non-negligible number of answers  
ORDER BY AccCount DESC

Enter Parameters

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