How many of this user's answers were accepted?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla

Q&A for Joomla! administrators, users, developers and designers

SELECT
COUNT(a.Id) AS "# answers",
COUNT(p.AcceptedAnswerId) AS "# accepted answers",
CAST(1.0*COUNT(p.AcceptedAnswerId)/COUNT(a.Id) AS DECIMAL(3,2)) AS "fraction accepted"
FROM Posts p
JOIN Posts a ON a.ParentId = p.Id
JOIN Users u ON a.OwnerUserId = u.Id
WHERE p.PostTypeId = 1 -- question
AND u.Id = ##UserId:int##

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results