Negative Asking Record Scores

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

;WITH QuestionDetail AS (
  SELECT
      CASE WHEN Score < 0 THEN 1 ELSE 0 END AS IsNegative,
      CASE WHEN ClosedDate   IS NOT NULL AND DATEDIFF(DAY, CreationDate, ClosedDate)   < 60 THEN 1 ELSE 0 END AS IsClosed,
      CASE WHEN DeletionDate IS NOT NULL AND DATEDIFF(DAY, CreationDate, DeletionDate) < 60 THEN 1 ELSE 0 END AS IsDeleted
  FROM Posts
  WHERE PostTypeId=1
  AND CreationDate < CAST(GETUTCDATE() AS DATE) -- only look at full days
),
QuestionScore AS (
  SELECT IsNegative + IsClosed + IsDeleted AS Points
  FROM QuestionDetail
)
SELECT IsNegative, IsClosed, IsDeleted, COUNT(*) AS Freq
FROM QuestionDetail
GROUP BY IsNegative, IsClosed, IsDeleted

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results