Preguntas y respuestas para programadores y profesionales de la informática
-- start and end need to be in this format -- yyyy/mm examples: -- '2015/10' -- '2016/01' -- ALERT: those values require to use single quotes SELECT LEFT(CONVERT(CHAR, creationdate, 111), 7) AS CreatedOn, Sum(CASE PostTypeId WHEN 1 THEN 1 ELSE 0 END) AS "#Questions", Sum(CASE PostTypeId WHEN 2 THEN 1 ELSE 0 END) AS "#Answers" FROM posts WHERE LEFT(CONVERT(CHAR, creationdate, 111), 7) BETWEEN ##start## AND ##end## AND PostTypeId IN (1,2) GROUP BY LEFT(CONVERT(CHAR, creationdate, 111), 7) ORDER BY 1 ASC