Average well-received questions per day

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском Meta

Вопросы и ответы о сайте для программистов

WITH Raw AS (
  SELECT
    DATEFROMPARTS(
      DATEPART(yyyy, CreationDate),
      DATEPART(mm, CreationDate),
      DATEPART(d, CreationDate)
    ) as Day,
    COUNT(*) AS Count
  FROM Posts
  WHERE
    PostTypeId = 1
    AND
    Score > 0
    AND
    ClosedDate IS NULL
  GROUP BY
    DATEFROMPARTS(
      DATEPART(yyyy, CreationDate),
      DATEPART(mm, CreationDate),
      DATEPART(d, CreationDate)
    )
)
SELECT
  A.Day,
  SUM(1.0 * (##Smoothing## - ABS(DATEDIFF(day, A.Day, B.Day))) * B.Count)
  /
  SUM(1.0 * (##Smoothing## - ABS(DATEDIFF(day, A.Day, B.Day)))) AS Count,
  10.0 AS GraduationRequirement
FROM Raw A, Raw B
WHERE
  DATEDIFF(day, A.Day, B.Day) BETWEEN -##Smoothing:int?45## AND ##Smoothing##
GROUP BY A.Day
ORDER BY A.Day DESC

Enter Parameters

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