Q&A for professional and enthusiast programmers
select p.id as [Post Link] from posts p inner join posts q on q.id = coalesce(p.parentid, p.id) inner join posthistory ph on ph.postid = p.id where text like '%```%' and ph.posthistorytypeid in (2,5,8) and p.creationdate between ##start## and ##end## and q.tags not like '%<r>%' and q.tags not like '%<rmarkdown>%' /* and not exists ( select 1 from posttags pt inner join tags t on t.id = pt.tagid where pt.postid = coalesce(p.parentid, p.id) and t.tagname in ('r', 'rmarkdown')) */