Forgotten zombie killers

2

Please login or register to vote for this query.

(click on this box to dismiss)

Zero-vote answers on questions with no accepted answer, and all answers with at most zero score (a.k.a. Zombie kill attempts left high and dry)

Code Review

Q&A for peer programmer code reviews

DECLARE @username AS NVARCHAR(60) = ##DisplayName:string? ##;
DECLARE @userId AS INT = ##UserId:int?-1##;

SELECT TOP ##Limit:int?100##
  u.Id AS [User Link],
  a.Id AS [Post Link],
  a.CreationDate
FROM Posts a
  JOIN Users u ON a.OwnerUserId = u.Id
  JOIN (
    SELECT q.Id, MAX(a.Score) MaxAnswerScore
    FROM Posts q
    JOIN Posts a ON a.ParentId = q.Id
    WHERE q.AcceptedAnswerId IS NULL
    GROUP BY q.Id
  ) q
  ON a.ParentId = q.Id
WHERE 
  (@username = '' OR u.DisplayName = @username)
  AND (@userId = -1 OR u.Id = @userId)
  AND a.Score = 0
  AND q.MaxAnswerScore = 0
ORDER BY a.CreationDate

Enter Parameters

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