Find the top comments, or comments with specific text or by users with a specific name. Names and comment text can contain the wildcard "%".
Q&A about the site for gardeners and landscapers
-- UserId: User ID "zero to disable" declare @user_id nvarchar = ##UserId:string?0## select --top (##TopN:int?100##) (case when c.UserId is not null then 'site://users/' + cast(c.UserId as nvarchar) + '|' else '' end) + coalesce(c.UserDisplayName, Users.DisplayName) as [User Link], c.Score as CommentScore, c.Id as [Comment Link], c.CreationDate from Comments c left join Users on Users.Id = c.UserId where lower(Text) like '%' + lower(##text:string##) + '%' and (##UserId## = 0 or c.UserId = ##UserId##) order by c.Score desc, c.CreationDate desc