Percentage of Answers that have been accepted

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts Meta

Q&A about the site for enthusiasts and power users of the Android operating system

-- Total number of answers accepted 
-- Returns people with 0 accepted answers as blanks

SELECT
u.Displayname AS Name, 
COUNT(*) AS TotalAns,
AccAns,
ROUND(((AccAns+0.0) / COUNT(*)+0.0),2) AS PercAcc,
u.Reputation AS Rep,
a.OwnerUserId
FROM Posts AS a 
  JOIN Users AS u ON a.OwnerUserId = u.Id
  LEFT JOIN 
      (
       SELECT COUNT(*) AS AccAns, t.OwnerUserId
       FROM Posts AS t
       WHERE t.Id IN (SELECT AcceptedAnswerId FROM Posts)
       GROUP BY t.OwnerUserId
      ) AS t2 ON t2.OwnerUserId=a.OwnerUserId
WHERE PostTypeID = 2 And AccAns >= 0
GROUP BY a.OwnerUserID, u.Displayname, u.Reputation, AccAns
ORDER BY TotalAns DESC

Enter Parameters

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