Avgerage Upvotes per Answer

0

Please login or register to vote for this query.

(click on this box to dismiss)

Average number of upvotes per answer

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

-- Avgerage Upvotes per Answer
-- Average number of upvotes per answer

SELECT
   TOP 20
   Users.Id,
   Users.DisplayName,
   COUNT(Posts.Id) As NumPosts,
   SUM(Posts.Score) As SumScore,
   AVG(Posts.Score) As AvgScore
FROM Posts
INNER JOIN Users ON Posts.OwnerUserID = Users.Id
WHERE Posts.PostTypeID = 2
AND Posts.ParentId IN (
-- Posts with a particular tag
SELECT
Posts.Id
FROM Posts
WHERE Posts.PostTypeID = 1
)

GROUP BY Users.Id, Users.DisplayName

Enter Parameters

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