Number of questions per tag per year

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

Q&A for программистов

select Id as PostId,
  YEAR(Posts.CreationDate) as [Year]
    into #PostSet
    from Posts
    where PostTypeId = 1 and
    DeletionDate is null

select [Year], Count(*) as Total
  into #YearTotals
  from #PostSet
  group by [Year]

select [Year], Tags.TagName as Tag, Count(*) as Number
  into #YearTagNumber
  from #PostSet
  join PostTags on #PostSet.PostId = PostTags.PostId
  join (select * from Tags where Count >= 2000) Tags on PostTags.TagId = Tags.Id
  group by [Year], Tags.TagName

select #YearTagNumber.[Year] as [Year],
       Tag, Number, Total
  from #YearTagNumber
  join #YearTotals on #YearTagNumber.[Year] = #YearTotals.[Year]
  order by #YearTagNumber.[Year], Tag

Enter Parameters

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