There is not a whole lot to say, but I found a few small things that could be improved. --- ###Consistency DECLARE @username as NVarchar(60) = RTRIM(LTRIM(##DisplayName:string? ##)); DECLARE @userId as int = ##UserId:int?-1##; DECLARE @limit as int = ##Limit:int?100##; Would be better as: DECLARE @userName AS NVARCHAR(60) = RTRIM(LTRIM(##DisplayName:string? ##)); DECLARE @userId AS INT = ##UserId:int?-1##; DECLARE @limit AS INT = ##Limit:int?100##; --- ###Aliases I think your aliases mostly obfuscate the query. It's also recommended to explicitly state the type of join, e.g.: FROM Posts AS posts INNER JOIN Users AS users ON p.OwnerUserId = u.Id INNER JOIN Posts AS questions ON p.ParentId = q.Id --- ###Trim Your left and right trim operations don't really achieve anything. Do you expect a user name to have a bunch of white space before or after it? I'm not sure SE would even allow that. I removed them and got identical results. --- Everything combined: DECLARE @username AS NVARCHAR(60) = ##DisplayName:string? ##; DECLARE @userId AS INT = ##UserId:int?-1##; DECLARE @limit AS INT = ##Limit:int?100##; SELECT TOP 100 users.Id AS [User Link], posts.Id AS [Post Link], posts.CreationDate FROM Posts AS posts INNER JOIN Users AS users ON posts.OwnerUserId = users.Id INNER JOIN Posts AS questions ON posts.ParentId = questions.Id WHERE (@username = '' OR users.DisplayName = @username) AND (@userId = -1 OR users.Id = @userId) AND posts.Score = 0 AND posts.Id = questions.AcceptedAnswerId ORDER BY posts.CreationDate DESC