with users as ( select DATEADD(DAY, DATEDIFF(DAY, 0, crea...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

with users as (
      -- users who asked a question with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, creationdate), 0) date, OwnerUserId user_id
      from posts
      where creationdate < '2020-08-01'
        and creationdate >= '2020-07-01'
        and tags like '%julia%'
     union all
      -- users who answered to the questions with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, p2.creationdate), 0) date, p2.OwnerUserId user_id
      from posts p1 left join posts p2 on p1.id = p2.parentid
      where p2.creationdate < '2020-08-01'
        and p2.creationdate >= '2020-07-01'
        and p1.tags like '%julia%'
     union all
      -- users who made an edit to the questions with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, LastEditDate), 0) date, LastEditorUserId user_id
      from posts
      where LastEditDate < '2020-08-01'
        and LastEditDate >= '2020-07-01'
        and tags like '%julia%'
     union all
      -- users who made an edit to the answers of questions with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, p2.LastEditDate), 0) date, p2.LastEditorUserId user_id
      from posts p1 left join posts p2 on p1.id = p2.parentid
      where p2.LastEditDate < '2020-08-01'
        and p2.LastEditDate >= '2020-07-01'
        and p1.tags like '%julia%'
     union all
      -- users who commented under questions with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, c.creationdate), 0) date, c.userid user_id
      from posts p join comments c on p.id = c.postid 
      where c.creationdate < '2020-08-01'
        and c.creationdate >= '2020-07-01'
        and p.tags like '%julia%'
     union all
      -- users who commented under answers to questions with the given tag
      select DATEADD(DAY, DATEDIFF(DAY, 0, c.creationdate), 0) date, c.userid user_id
      from posts p2 right join posts p1 on p1.id = p2.parentid
                          join comments c on p2.id = c.postid 
      where c.creationdate < '2020-08-01'
        and c.creationdate >= '2020-07-01'
        and p1.tags like '%julia%'
      )
    select date, 'Julia' programming_language, count(distinct user_id) distinct_users_count
    from users
    group by date

Enter Parameters

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