What percentage of my answers are accepted?

10

Please login or register to vote for this query.

(click on this box to dismiss)

Returns the total number of answers, the number of accepted answers, and what percentage of answers are accepted.

CiviCRM

Q&A for administrators and users of the CiviCRM Constituent Relationship Management software

-- What percentage of my answers are accepted?
-- Returns the total number of answers, the number of accepted answers, and what percentage of answers are accepted.

SELECT
    Count(a.Id) AS [Total Answers],
    Sum(CASE q.AcceptedAnswerId WHEN a.Id THEN 1 ELSE 0 END) AS [Accepted Answers],  
    Round(Sum(CASE q.AcceptedAnswerId WHEN a.Id THEN 1 ELSE 0 END) * 100.0 / Count(a.Id), 1) AS [Percentage Accepted]
FROM
    Posts AS a
  JOIN Posts AS q
    ON a.ParentId = q.Id
WHERE
      a.OwnerUserId = ##UserId##
  AND q.postTypeId = 1
  AND a.postTypeId = 2

Enter Parameters

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