Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3980184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:15:37+00:00 2026-05-20T05:15:37+00:00

I’d like to compare the popularity of tags between two months, ordered by the

  • 0

I’d like to compare the popularity of tags between two months, ordered by the biggest change.

I’ve worked out how to count the number of tags in a month, but not how to compare them. Here’s what I have so far:

select TOP 10
    tags.tagname, count(*) AS tagcount
from Posts
    INNER JOIN PostTags ON PostTags.PostId = Posts.id
    INNER JOIN Tags     ON Tags.id         = PostTags.TagId
where
    datepart(year,  Posts.CreationDate) = 2011 and
    datepart(month, Posts.CreationDate) = 1
Group by tags.tagname
Order by tagcount DESC

https://data.stackexchange.com/stackoverflow/qe/924/query-count-tags-from-daterange
(note: you can clone, edit in place, and run it)

I’m new to SQL. It seems I just need to create a second query for the previous month (December 2010), and then combine these two queries, with a column that is prevMonth.count - nextMonth.count, and order by that column (getting just the top X, so it doesn’t take forever).

But I can’t work out how to combine two queries in this way – I think you should be able to nest them, but I can’t get it to work. Another way is to create a temporary table – it seems inefficient to me, but maybe that is the right way?

Many thanks for any help!


BTW: what I’d like to do next:

  1. After this, I’d like to find the rate of growth (not just the absolute change in numbers). That’s just (new-old)/old. Like velocity, but normalized.

  2. Then, the tags whose rate of growth is increasing the most – i.e. that have exponential growth. This is would require 3 months: calculate the rate of change between months 1 and 2, and between months 2 and 3. The difference between these is the rate of change of the rate of change. It’s like acceleration.

[ This is as a signal for new technologies growing, which often start small in a very specific usage. The people in that small area talk to each other, and good ideas get passed on in a chain-reaction: one person tells two, they each tell two more and so on. The that niche might get converted fully after a while, and maybe it spreads to another, similar niche. See "Seeing What’s Next", by the Innovator’s Dilemma guy. ]


Here’s a later version, using JNK’s answer:
https://data.stackexchange.com/stackoverflow/q/92869/query-tags-with-highest-increase-in-growth-over-3-months

And… the fastest growing tag is… facebook-c#-sdk. Dunno how useful this is, but it’s an interesting way to browse SO.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:15:38+00:00Added an answer on May 20, 2026 at 5:15 am

    Use #Temp Tables:

    -- QUERY: count tags from daterange
    -- TODO: compare from two different dateranges...
    
    select TOP 10
        tags.tagname, count(*) AS tagcount
    INTO #TagCountTemp1
    from Posts
        INNER JOIN PostTags ON PostTags.PostId = Posts.id
        INNER JOIN Tags     ON Tags.id         = PostTags.TagId 
    where
        datepart(year,  Posts.CreationDate) = 2011 and
        datepart(month, Posts.CreationDate) = 1
    Group by tags.tagname
    Order by tagcount DESC
    
    select TOP 10
        tags.tagname, count(*) AS tagcount
    INTO #TagCountTemp2
    from Posts
        INNER JOIN PostTags ON PostTags.PostId = Posts.id
        INNER JOIN Tags     ON Tags.id         = PostTags.TagId 
    where
        datepart(year,  Posts.CreationDate) = 2010 and
        datepart(month, Posts.CreationDate) = 12
    Group by tags.tagname
    Order by tagcount DESC
    
    SELECT TOP 10
    t2.tagname, t2.tagcount as 'Month 1', t1.tagcount as 'Month 2', (t1.tagcount-t2.tagcount) as 'Increase'
    FROM #TagCountTemp1 as t1
    LEFT JOIN #TagCountTemp2 as t2
      ON T1.tagname = t2.tagname
    ORDER BY (t1.tagcount-t2.tagcount) desc​​​​​​​​​​​​​​​
    

    ​This worked fine for me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.