Average number of votes on all sites

7

Please login or register to vote for this query.

(click on this box to dismiss)

For each site, show the average number of votes per post (questions and answers alike)

Stack Apps

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

SELECT
    Count(*) * 1.0 / (SELECT Count(*) FROM Posts WHERE PostTypeId = 1 OR PostTypeId = 2) AS [Votes],
    Count(CASE VoteTypeID WHEN 2 THEN 1 END) * 1.0 / (SELECT Count(*) FROM Posts WHERE PostTypeId = 1 OR PostTypeId = 2) AS [Upvotes],
    Count(CASE VoteTypeID WHEN 3 THEN 1 END) * 1.0 / (SELECT Count(*) FROM Posts WHERE PostTypeId = 1 OR PostTypeId = 2) AS [Downvotes]
  FROM Votes
  WHERE (VoteTypeId = 2 OR VoteTypeId = 3)

Enter Parameters

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