Accept rate by user

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Apps

Q&A for apps, scripts, and development with the Stack Exchange API

DECLARE @UserId int = ##UserId##
SELECT TOP 100
  s.uid,
  s.uid AS [User Link],
  s.answers_count,
  s.accepted_count,
  s.accepted_count * 1.0 / s.answers_count as accept_rate
FROM (SELECT
  a.owneruserid uid,
  COUNT(1) AS answers_count,
  SUM(CASE
    WHEN q.id IS NULL THEN 0
    ELSE 1
  END) AS accepted_count
FROM posts a
LEFT JOIN posts q
  ON a.parentid = q.id
  AND q.posttypeid = 1
  AND a.id = q.acceptedanswerid
WHERE a.posttypeid = 2
Group BY a.owneruserid) s
ORDER BY accepted_count DESC,  accept_rate DESC

Enter Parameters

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