Unique users that create a post (total, Q and A) since 2021

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select DATEADD(week, DATEDIFF(week, -1, creationdate), -1) [week]
     , count(distinct owneruserid) [# unique users]
     , count(distinct case when posttypeid = 1 then owneruserid else null end) [# q-users]
     , count(distinct case when posttypeid = 2 then owneruserid else null end) [# a-users]
     , count(*) [total]
from posts
where creationdate 
      between DATEADD(week, DATEDIFF(week, -1, '2018-01-01'), -1)
      and DATEADD(week, DATEDIFF(week, -1, getdate()), -1)
group by DATEADD(week, DATEDIFF(week, -1, creationdate), -1) 
order by DATEADD(week, DATEDIFF(week, -1, creationdate), -1)

Enter Parameters

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