select dateadd(week, datediff(week, 0, posthistory.creati...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

select dateadd(week, datediff(week, 0, posthistory.creationdate), 0),
sum(case when posthistorytypeid = 1 then 1 else 0 end) as [asked],
sum(case when posthistorytypeid = 10 then 1 else 0 end) as [closed],
sum(case when posthistorytypeid = 17 then 1 else 0 end) as [migrated],
sum(case when posthistorytypeid = 12 then 1 else 0 end) as [deleted]
from posthistory
left outer join posts on posthistory.postid = posts.id
where posthistory.creationdate >= '1/1/2012'
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