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),
             'Average amount of hours between question posed and answered' = AVG(DATEDIFF(hour, p1.CreationDate, p.CreationDate)),
             (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 calculate_max)
      FROM Posts p
      INNER JOIN Posts p1 ON p.Id = p1.AcceptedAnswerId
      GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, p.CreationDate), 0)

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 calculate_max

Enter Parameters

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