select dateadd(week, datediff(week, 0, posts.creationdate...

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, posts.creationdate), 0), 
count(*) as [NewQuestions],
sum(case when posts.creationdate > dateadd(day, 30, users.creationdate) then 1 else 0 end) as [User>30Days],
sum(case when posts.creationdate > dateadd(day, 30, users.creationdate) then 0 else 1 end) as [User<30Days]
from posts
inner join users on posts.owneruserid = users.id
where posts.creationdate >= '1/1/2011' and posts.posttypeid = 1
group by dateadd(week, datediff(week, 0, posts.creationdate), 0)
order by dateadd(week, datediff(week, 0, posts.creationdate), 0)

Enter Parameters

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