Lists the number of questions with pending close votes by year and month that the first one was cast, along with number of questions with close votes and the avg close votes per question.
Q&A for enthusiasts and scholars of mythology and folklore
with ClosingPosts as ( SELECT Posts.Id as PostId, MIN(Votes.CreationDate) as FirstVoteTime, Count(Votes.Id) as Votes FROM Posts LEFT JOIN Votes on Posts.Id=Votes.PostId and VoteTypeId=6 WHERE PostTypeId=1 and ClosedDate is null and Votes.Id is not null GROUP BY Posts.Id ) select DATEPART(yyyy, FirstVoteTime) as Year, DATEPART(mm, FirstVoteTime) as Month, COUNT(*) as Questions, CONVERT(NUMERIC(3,2), CAST(SUM(Votes) as float) / COUNT(*)) as AvgCloseVotes from ClosingPosts GROUP BY DATEPART(yyyy, FirstVoteTime),DATEPART(mm, FirstVoteTime) order by Year, Month