Zombies are questions with no upvoted answers. I came up with this SEDE query to find answers with zero votes on questions that have no accepted answer and no answers with greater than zero score. In other words, answers on questions that show up on the Unanswered tab, until the answer receives an upvote. (Latest version is here, FYI, not subject for review.)
DECLARE @username AS NVARCHAR(60) = ##DisplayName:string? ##; DECLARE @userId AS INT = ##UserId:int?-1##; SELECT TOP 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 DESC
Is there a better way to write this? Can it be improved?