Number of created and closed posts per year

0

Please login or register to vote for this query.

(click on this box to dismiss)

GIS

Q&A for cartographers, geographers and GIS professionals

WITH 
t1 AS(
  SELECT YEAR(CreationDate) AS YearCreated, COUNT(YEAR(CreationDate)) AS created
  FROM Posts
  GROUP BY YEAR(CreationDate)),
t2 AS(
  SELECT YEAR(ClosedDate) AS YearClosed, COUNT(YEAR(ClosedDate)) AS closed
  FROM Posts
  GROUP BY YEAR(ClosedDate))
SELECT t1.YearCreated AS year, t1.created, t2.closed, 100*(1.0*t2.closed)/(1.0*t1.created) AS ratioClosed
FROM t1
LEFT JOIN t2
ON t2.YearClosed = t1.YearCreated
ORDER BY 1

Enter Parameters

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