Tags and their wikis and excerpts that are similar to [tag name]

0

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

declare @tagToSearch nvarchar(35) = ##tag:string##;
declare @startsWith bit = iif(##starts:int?1## >= 1, 1, 0);

declare @matcher nvarchar(35) = iif(
  @startsWith = 1, 
  @tagToSearch + '%', 
  '%' + @tagToSearch + '%'
  )

select
  T.TagName,
  WE.Body as Excerpt,
  WW.Body as Wiki,
  'site://tags/' + TS.TargetTagName + '|' + Ts.TargetTagName as [Synonym Of],
  (
    select string_agg ('<'+TSS.SourceTagName+'>', '')
    from TagSynonyms as TSS 
    where TSS.TargetTagName = T.TagName
  ) as [Tags]
from
  Tags as T
  left join Posts as WE on WE.Id = T.ExcerptPostId
  left join Posts as WW on WW.Id = T.WikiPostId
  left join TagSynonyms as TS on TS.SourceTagName = T.TagName
where
  T.TagName like (@matcher)
order by
  T.TagName
asc

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results