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], p.Id as [Post Link], p.CreationDate FROM Posts p JOIN Users u ON p.OwnerUserId = u.Id JOIN Posts q ON p.ParentId = q.Id AND q.OwnerUserId != u.Id WHERE (@username = '' OR u.DisplayName = @username) AND (@userId = -1 OR u.Id = @userId) AND p.Score = 0 AND p.Id = q.AcceptedAnswerId AND p.OwnerUserId = u.Id AND q.ClosedDate IS NULL AND q.DeletionDate IS NULL AND q.CommunityOwnedDate IS NULL ORDER BY p.CreationDate