Asked/Closed/Reopened per week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Worldbuilding

Q&A for writers/artists using science, geography and culture to construct imaginary worlds and settings

SELECT dateadd(week, datediff(week, 0, posthistory.creationdate), 0),
sum(case when posthistory.posthistorytypeid = 1 then 1 else 0 end) as [asked],
sum(case when posthistory.posthistorytypeid = 10 then 1 else 0 end) as [closed],
sum(case when posthistory.posthistorytypeid = 11 then 1 else 0 end) as [reopened]
FROM posthistory
INNER JOIN posts ON posthistory.postid = posts.id
WHERE posthistory.creationdate between '5/1/2012' AND dateadd(week, datediff(week, 0, GetDate()), 0)
AND posts.posttypeid = 1
GROUP BY dateadd(week, datediff(week, 0, posthistory.creationdate), 0)
ORDER BY dateadd(week, datediff(week, 0, posthistory.creationdate), 0)

Enter Parameters

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