Deleted questions by the total number of votes with answers

1

Please login or register to vote for this query.

(click on this box to dismiss)

Reverse Engineering Meta

Q&A about the site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation

WITH QRaw AS (
  SELECT
    PostsWithDeleted.Id,
    COUNT(*) AS VoteCount
  FROM PostsWithDeleted
  LEFT JOIN Votes ON PostsWithDeleted.Id = Votes.PostId
  WHERE
    PostsWithDeleted.PostTypeId = 1
    AND
    PostsWithDeleted.DeletionDate IS NOT NULL
  GROUP BY PostsWithDeleted.Id
),
ARaw AS (
  SELECT
    PostsWithDeleted.ParentId,
    COUNT(*) AS VoteCount
  FROM PostsWithDeleted
  LEFT JOIN Votes ON PostsWithDeleted.Id = Votes.PostId
  WHERE PostsWithDeleted.PostTypeId = 2
  GROUP BY PostsWithDeleted.ParentId
)
SELECT TOP 100
  QRaw.Id,
  'site://questions/' + CAST(QRaw.Id AS VARCHAR(MAX)) AS [Link],
  QRaw.VoteCount + COALESCE(ARaw.VoteCount, 0) AS VoteCount
FROM QRaw
LEFT JOIN ARaw ON ARaw.ParentId = QRaw.Id
ORDER BY VoteCount DESC, QRaw.Id

Enter Parameters

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