Answers per user

0

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 answers per person

Declare @totalNumberOfAnswers int
Declare @totalNumberOfUsers float
Declare @averageAnswerPerUser float

select @totalNumberOfUsers = count(Id) from Users
select @totalNumberOfAnswers = sum(PostTypeId) FROM Posts where PostTypeId='2';


select @averageAnswerPerUser = @totalNumberOfAnswers / @totalNumberOfUsers 

select @averageAnswerPerUser as 'The average number of answers per user'

Enter Parameters

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