Non-closed questions by month and answers to them

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 
  datepart(year,p.CreationDate) + (datepart(month,p.CreationDate)-1)/12.0 
    as [date],
  Name,
  count(*) N
FROM Posts p
     join PostTypes pt on p.PostTypeId = pt.Id
     join Posts q on isnull(p.ParentId, p.Id) = q.Id
WHERE 
  p.PostTypeId in (1,2) AND 
  datepart(year, p.CreationDate) >= ##startYear?2010## AND
  datepart(year, p.CreationDate) <= ##endYear?2015##
  and q.ClosedDate is null
  and p.Score >= 0 and q.Score >= ##score?0##
GROUP BY 
  datepart(year,p.CreationDate) + (datepart(month,p.CreationDate)-1)/12.0,
  Name 
ORDER BY 
  datepart(year,p.CreationDate) + (datepart(month,p.CreationDate)-1)/12.0,
  Name

Enter Parameters

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