Up-to-date content: Average amount of hours between question posed and answered

0

Please login or register to vote for this query.

(click on this box to dismiss)

Software Engineering

Q&A for professionals, academics, and students working within the systems development life cycle

SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, p.CreationDate), 0),
             'Up-to-date content' = 1 - CAST(AVG(DATEDIFF(hour, p1.CreationDate, p.CreationDate)) AS FLOAT) /
             (SELECT max = MAX([Average amount of hours between question posed and answered])
              FROM (
                    SELECT Month = DATEADD(MONTH, DATEDIFF(MONTH, 0, p.CreationDate), 0),
                           'Average amount of hours between question posed and answered' = AVG(DATEDIFF(hour, p1.CreationDate, p.CreationDate))
                    FROM Posts p
                    INNER JOIN Posts p1 ON p.Id = p1.AcceptedAnswerId
                    GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, p.CreationDate), 0)
                   ) AS average_time_passed)
FROM Posts p
INNER JOIN Posts p1 ON p.Id = p1.AcceptedAnswerId
GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, p.CreationDate), 0)
ORDER BY Month

Enter Parameters

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