Number of closes per week the last year

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

-- This will compute the number of closed questions per week for the last year

SELECT
  datepart(week, ClosedDate) AS [Week], 
  COUNT(*) AS [Number of Closed Questions]
FROM Posts
WHERE PostTypeId = 1 -- question
  AND ClosedDate IS NOT NULL
  AND DATEDIFF(DAY, ClosedDate, GETDATE()) < DATEDIFF(DAY, 'Jan 1, 2015', GETDATE())
GROUP BY datepart(week, ClosedDate)
ORDER BY datepart(week, ClosedDate)

Enter Parameters

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