Comments from Questions and Answers per month posted with the tagname used and a given duration


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(*) AS TOTAL,
       DATENAME(mm, c.CreationDate) AS MONTH_NAME,
       DATENAME(yyyy, c.CreationDate) AS YEAR,
       MONTH(c.CreationDate) AS MONTH_NUM
 from  Comments c,
  from  Posts p1, PostTags ptags1, Tags t1, PostTypes ptypes1 
 where  p1.posttypeid =
   and = 1
   and = ptags1.postid 
   and  ptags1.tagid = 
   and  t1.tagname = '##TagName##'
  from  Posts p2, PostTypes ptypes2 
 where  p2.posttypeid =
   and = 2
   and  p2.parentid in
     (  select
          from  Posts p3, PostTags ptags3, Tags t3, PostTypes ptypes3 
         where  p3.posttypeid =
           and = 1
           and = ptags3.postid 
           and  ptags3.tagid = 
           and  t3.tagname = '##TagName##'
) temp_p
where = c.postid
and    c.CreationDate >= '##startdate##'
and    c.CreationDate <= '##enddate##'
group by DATENAME(yyyy, c.CreationDate), MONTH(c.CreationDate), DATENAME(mm, c.CreationDate)
order by DATENAME(yyyy, c.CreationDate) ASC, MONTH(c.CreationDate) ASC, DATENAME(mm, c.CreationDate) ASC

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results