Q&A about the site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation
declare @symbolsearch nvarchar(200) = ##symbol:string## --declare @tag nvarchar(35) = ##tag:string?r## set @symbolsearch = replace(@symbolsearch,'[', '[[]'); set @symbolsearch = replace(@symbolsearch,'_', '[_]'); set @symbolsearch = replace(@symbolsearch,'\n', concat(char(13), char(10))); set @symbolsearch = replace(@symbolsearch,'%', '[%]'); with /* tagposts as ( select p.id from posts p inner join posttags pt on pt.postid = coalesce(p.parentid, p.id) inner join tags t on t.id = pt.tagid where tagname = @tag ), */ posthistoryedits as ( select ph.postid , max(ph.id) [latestid] from posthistory ph --inner join tagposts tp on tp.id = ph.postid where posthistorytypeid in (2,5) group by ph.postid ), posthistorytext as ( select ph.postid , ph.text from posthistory ph inner join posthistoryedits phe on phe.latestid = ph.id ) select top 200 -- count(*) p.id as [Post Link] , p.posttypeid , p.score , p.creationdate , p.tags , pht.text --from tagposts tp inner join posts p on tp.id = p.id from posts p inner join posthistorytext pht on pht.postid = p.id --where pht.text like concat('%', @symbolsearch, '%') --and ( pht.text like '%below%' or pht.text like '%under%') and pht.text like '%compat=1.11%' --where pht.text like '%rgb[\]}]{[0-9][0-9]%' escape '\' order by p.score desc