Questions with longest non-edit histories (incl. answers)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

WITH Raw AS (
  SELECT PostId, COUNT(*) AS Count
  FROM PostHistory
  WHERE
    PostHistoryTypeId >= 10
    AND
    PostHistoryTypeId NOT IN (16, 24, 25, 31, 33, 34, 50)
  GROUP BY PostId
),
Raw2 AS (
  SELECT
    Posts.Id AS PostId,
    COALESCE(Posts.ParentId, Posts.Id) AS QId,
    COALESCE(Count, 0) AS Count
  FROM Posts
  LEFT JOIN Raw ON Posts.Id = Raw.PostId
)
SELECT TOP 100
  QId AS [Post Link],
  'site://posts/' + CAST(QId AS VARCHAR(MAX)) + '/timeline|timeline' AS timeline,
  SUM(Count) AS Count,
  QId
FROM Raw2
GROUP BY QId
ORDER BY Count DESC, QId

Enter Parameters

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