Average accept rate (for the whole site)

0

Please login or register to vote for this query.

(click on this box to dismiss)

The average accept rate among all users of the target site.

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

SELECT AVG(a.[Accept Rate]) AS [Average accept rate]
FROM
(
  SELECT 
    p.OwnerUserId, 
    CAST(
      CAST(COUNT(p.AcceptedAnswerId) AS FLOAT) / CAST(COUNT(p.Id) AS FLOAT) * 100 
        AS DECIMAL(5,2)
     ) AS [Accept Rate]
  FROM Posts p
  WHERE 
    p.PostTypeId = 1 -- Only questions
    AND p.ClosedDate IS NULL -- that have not been closed
    AND p.CommunityOwnedDate IS NULL -- and are not CW
    AND p.AnswerCount > 0 -- and actually have some answers
    AND (p.OwnerUserId IS NOT NULL AND p.OwnerUserId <> '') -- bleep bloop
  GROUP BY p.OwnerUserId
  HAVING COUNT(p.Id) >= 4 -- Need at least 4 questions for accept rate
) AS a

Enter Parameters

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