Number of upvotes per post


Please login or register to vote for this query.

(click on this box to dismiss)

Super User

Q&A for computer enthusiasts and power users

-- Average number of upvotes per post

Declare @totalNumberOfUpvotes int
Declare @totalNumberOfQuestions float
Declare @averageUpvotePerQuestion float

select @totalNumberOfUpvotes = sum(UpVotes) FROM Users ;
select @totalNumberOfQuestions = sum(PostTypeId) FROM Posts where PostTypeId='1';

select @averageUpvotePerQuestion = @totalNumberOfUpvotes / @totalNumberOfQuestions 
select @averageUpvotePerQuestion as 'The average number of upvotes for each question'

Enter Parameters

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