Number of unique users on Questions posted per month for a given tag and time duration

1

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 count(DISTINCT temp_p.OwnerUserId) AS USERS,
       DATENAME(mm, temp_p.CreationDate) AS MONTH_NAME,
       DATENAME(yyyy, temp_p.CreationDate) AS YEAR,
       MONTH(temp_p.CreationDate) AS MONTH_NUM
 from  
(
  select  p3.OwnerUserId, p3.CreationDate
    from  Posts p3, PostTags ptags3, Tags t3, PostTypes ptypes3 
   where  p3.posttypeid = ptypes3.id
     and  ptypes3.id = 1
     and  p3.id = ptags3.postid 
     and  ptags3.tagid = t3.id 
     and  t3.tagname = '##TagName##'
     and  p3.CreationDate >= '##startdate##'
     and  p3.CreationDate <= '##enddate##'
) temp_p
group by DATENAME(yyyy, temp_p.CreationDate), MONTH(temp_p.CreationDate), DATENAME(mm, temp_p.CreationDate)
order by DATENAME(yyyy, temp_p.CreationDate) ASC, MONTH(temp_p.CreationDate) ASC, DATENAME(mm, temp_p.CreationDate) ASC

Enter Parameters

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