Q&A for science fiction and fantasy enthusiasts
; 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