Average question score by day

0

Please login or register to vote for this query.

(click on this box to dismiss)

What the title says

Emacs Meta

Q&A about the site for those using, extending or developing Emacs

DECLARE @tag VARCHAR(20);
SET @tag = 'javascript';

DECLARE @startyear DATETIME;
SET @startyear = '2010';

DECLARE @endyear DATETIME;
SET @endyear = '2018';

SELECT
  CAST(YEAR(CreationDate) AS VARCHAR(4)) + '-' + CAST(MONTH(CreationDate) AS VARCHAR(2)),
  -- gotta be a better way to do that
  ROUND(CAST(SUM(Score) AS FLOAT)/COUNT(Score), 2)
FROM Posts
WHERE
  CreationDate > @startyear AND
  CreationDate < @endyear --AND
  --CHARINDEX(@tag, Tags) > 0
GROUP BY
  YEAR(CreationDate),
  MONTH(CreationDate)
ORDER BY
  YEAR(CreationDate),
  MONTH(CreationDate);

Enter Parameters

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