historic language popularity

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

select TagName,
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -6, GetDate())
      and Posts.CreationDate < DATEADD(year, -5, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2008',
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -5, GetDate())
      and Posts.CreationDate < DATEADD(year, -4, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2009',
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -4, GetDate())
      and Posts.CreationDate < DATEADD(year, -3, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2010',
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -3, GetDate())
      and Posts.CreationDate < DATEADD(year, -2, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2011',
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -2, GetDate())
      and Posts.CreationDate < DATEADD(year, -1, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2012',
  (
    select count(TagName)
    from Tags
    join PostTags on PostTags.TagId = Tags.Id
    join Posts on Posts.Id = PostTags.PostId
    where Posts.CreationDate > DATEADD(year, -1, GetDate())
    and TagName = allTheTags.TagName
    group by Tags.TagName
  ) as '2013'

from Tags allTheTags
where allTheTags.TagName like 'windows-phone'
order by allTheTags.TagName

Enter Parameters

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