Average answer's (reputation / popularity) ratio for a given user


Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

-- What is the average answer's (reputation / popularity) ratio for a given user ? 

DECLARE @UserId int = ##UserId##

  COUNT(a.id) AS Answers,
  SUM(CASE WHEN q.AcceptedAnswerId = a.Id THEN 1 ELSE 0 END) AS Accepted,
  SUM(a.Score) AS Score,
  SUM(q.ViewCount) AS Views,
  ROUND(SUM( (CAST(a.Score AS float) / CAST(q.ViewCount AS float)) * 100) / COUNT(a.id), 3) as [Average Ratio]
FROM Posts a
  INNER JOIN Posts q ON q.Id = a.ParentId

WHERE a.PostTypeId = 2
  AND a.OwnerUserId = @UserId

Enter Parameters

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