Monthly top 10 popular tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

SELECT [Month], Tag, QuestionCount
  FROM (
SELECT [Month], Tag, QuestionCount, ROW_NUMBER() OVER (PARTITION BY [Month] ORDER BY QuestionCount DESC) QCRank
  FROM (
    SELECT [Month], Tag, COUNT(*) QuestionCount
      FROM (
        SELECT MONTH(CreationDate) [Month], p.Id, t.Tag
          FROM Posts p
         OUTER APPLY (
                 SELECT REPLACE(REPLACE(value, '<', ''), '>', '') Tag
                   FROM STRING_SPLIT(p.Tags, '>')
                  WHERE LEN(value) > 0) t
         WHERE PostTypeId = 1 
           AND YEAR(CreationDate) = ##Year:int##) raw -- questions
         GROUP BY [Month], Tag) a1) a2
 WHERE a2.QCRank >= 10
 ORDER BY a2.[Month], a2.QCRank

Enter Parameters

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