Average views per question by month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

SELECT
  DatePart(YEAR, p.CreationDate) * 100 + DatePart(MONTH, p.CreationDate) AS [Date],
  Avg(p.ViewCount) AS [All],
  Avg(CASE p.ClosedDate WHEN NULL THEN NULL ELSE p.ViewCount END) AS [Open]
FROM Posts p
WHERE p.PostTypeId = 1
GROUP BY DatePart(YEAR, p.CreationDate) * 100 + DatePart(MONTH, p.CreationDate)
ORDER BY DatePart(YEAR, p.CreationDate) * 100 + DatePart(MONTH, p.CreationDate) DESC

Enter Parameters

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