Answers per Question

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 question

Declare @totalNumberOfAnswers int
Declare @totalNumberOfQuestions float
Declare @averageAnswerPerQuestion float

select @totalNumberOfQuestions = sum(PostTypeId) FROM Posts where PostTypeId='1';
select @totalNumberOfAnswers = sum(PostTypeId) FROM Posts where PostTypeId='2';


select @averageAnswerPerQuestion = @totalNumberOfAnswers / @totalNumberOfQuestions 

select @averageAnswerPerQuestion as 'The average number of answers per question'

Enter Parameters

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