Question States over Time (Percent)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

WITH Batches AS (
SELECT
  DATEADD(mm, DATEPART(mm, Answer.CreationDate)-1, DATEADD(yy, DATEPART(yyyy, Answer.CreationDate)-1900, 0)) as [Date],
  COUNT(*) as Total,
  SUM(CASE when Question.Score > 0 then 1 else 0 END) as [Upvoted],
  SUM(CASE when Question.Score < 0 then 1 else 0 END) as [Downvoted],
  SUM(CASE when Question.CommentCount > 0 then 1 else 0 END) as [Commented],
  SUM(CASE when Question.DeletionDate is not null then 1 else 0 END) as [Deleted],
  SUM(CASE when Question.LastEditDate is not null then 1 else 0 END) as [Edited],
  SUM(CASE when Question.AnswerCount > 0 then 1 else 0 END) as [Answered],
  SUM(CASE when Question.AcceptedAnswerId is not null then 1 else 0 END) as [AnsweredAccepted],
  SUM(CASE when Answer.Id is not null then 1 else 0 END) as [AnsweredUpvoted]
FROM
  PostsWithDeleted as Answer
  RIGHT JOIN
  PostsWithDeleted as Question on Answer.ParentId = Question.Id and Answer.Score > 0
WHERE
  Question.PostTypeId = 1 and
  Answer.PostTypeId = 2
GROUP BY
  DATEPART(yyyy, Answer.CreationDate),
  DATEPART(mm, Answer.CreationDate)
)
  
SELECT
  [Date],
  Total * 100.0 / Total as [Total],
  Upvoted * 100.0 / Total as [Upvoted],
  Downvoted * 100.0 / Total as [Downvoted],
  Edited * 100.0 / Total as [Edited],
  Deleted * 100.0 / Total as [Deleted],
  Answered * 100.0 / Total as [With answer],
  AnsweredAccepted * 100.0 / Total as [With accepted answer],
  AnsweredUpvoted * 100.0 / Total as [With upvoted answer]
FROM Batches
ORDER BY Date;

Enter Parameters

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