Declare @TagList TABLE (TagNameLike nvarchar(25) COLLATE ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Christianity

Q&A for committed Christians, experts in Christianity and those interested in learning more

Declare @TagList TABLE (TagNameLike nvarchar(25) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL)

INSERT INTO @TagList VALUES (##tag1:string##), (##tag2:string##)

select *, count(*) from
(
  select CAST(
      cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01'
    as datetime) [Month], 
    tl.TagNameLike
  from Posts p 
  INNER JOIN PostTags pt on pt.PostId = p.Id
  INNER JOIN Tags t on t.Id = pt.TagId
  INNER JOIN @TagList tl ON t.TagName LIKE '%' + tl.TagNameLike + '%' 
) as X
group by TagNameLike, [Month]
having count(*) > 25
order by [Month] asc, TagNameLike asc

Enter Parameters

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