Average of time between posts and accepted answer creation, by months

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow em Português

Q&A for professional and enthusiast programmers

SELECT
CONVERT(DATETIME, CONCAT(YEAR(p.CreationDate), '-', MONTH(p.CreationDate), '-01'), 20) AS Mes,
CONVERT(float,avg(datediff(hour,p.CreationDate,ans.CreationDate)))/24

FROM Posts as p JOIN Posts as ans ON ans.Id=p.AcceptedAnswerId
WHERE p.AcceptedAnswerId>0  
GROUP BY YEAR(p.CreationDate), MONTH(p.CreationDate)
ORDER BY YEAR(p.CreationDate), MONTH(p.CreationDate)

Enter Parameters

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