SELECT dateadd(month, datediff(month, 0, CreationDate), 0...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for expert programmers interested in professional discussions on software development

SELECT
    dateadd(month, datediff(month, 0, CreationDate), 0) as [Month],
    Avg(Cast(Score AS Float)) AS [Posts],
    Avg(CASE PostTypeID WHEN 1 THEN Cast(Score AS Float) END) AS [Questions],
    Avg(CASE PostTypeID WHEN 2 THEN Cast(Score AS Float) END) AS [Answers]
  FROM Posts
  WHERE (PostTypeId = 1 OR PostTypeId = 2)
  AND CreationDate >= '1/1/2011'
  GROUP BY dateadd(month, datediff(month, 0, CreationDate), 0)
  ORDER BY [Month]

Enter Parameters

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