6 tags on XXX.stackexchange.com

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

Declare @Tag1 varchar(20)
Declare @Tag2 varchar(20)
Declare @Tag3 varchar(20)
Declare @Tag4 varchar(20)
Declare @Tag5 varchar(20)
Declare @Tag6 varchar(20)

set @Tag1 = ##tag1:string?java##
set @Tag2 = ##tag2:string?python##
set @Tag3 = ##tag3:string?r##
set @Tag4 = ##tag4:string?javascript##
set @Tag5 = ##tag5:string?_##
set @Tag6 = ##tag6:string?_##

select *, count(*) from
(
  select CAST(
      cast(DATEPART(YYYY, CreationDate) as varchar) + '-' + cast(DATEPART(MM, CreationDate) as varchar) + '-01'
    as datetime) [Month], 
    t.TagName
  from Posts p 
  join PostTags pt on pt.PostId = p.Id
  join Tags t on t.Id = pt.TagId
  where TagName in 
  (
  @Tag1, 
  @Tag2,
  @Tag3,
  @Tag4,
  @Tag5,
  @Tag6
  ) and
   p.CreationDate > '2020-12-31'
) as X

group by TagName, [Month]
order by [Month] asc, TagName asc

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results