What's going up, what's going down

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @AnnualPosts TABLE
(
  y int,
  numPosts int
)

INSERT INTO @AnnualPosts (y, numPosts)

  select year(CreationDate), count(id)
  from Posts
  where answerCount + CommentCount > 0
  group by year(CreationDate)

DECLARE @TopTags TABLE
(
  tagId int,
  tagName varChar(32),
  usage int, 
  y int
)

INSERT INTO @TopTags (tagID, tagName, usage, y)

  select top 100 t.id tagId, t.tagName, count(p.id) postCount, 2015
  from tags t
  join PostTags pTags on pTags.tagId = t.id
  join Posts p on pTags.postId = p.id
  where year(p.creationDate) = 2015
  group by t.Id, t.tagName
  order by count(p.id) desc 
  

select * from @TopTags

Enter Parameters

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