Answers - number and percentage of accepted answers

1

Please login or register to vote for this query.

(click on this box to dismiss)

Writing

Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing

; 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  
ORDER BY AccCount DESC

Enter Parameters

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