Questions with top 10 tags in September 2020, and their tags

0

Please login or register to vote for this query.

(click on this box to dismiss)

Russian Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language

SELECT
p.Id,
p.Tags

FROM Posts AS p

INNER JOIN PostTypes as ptypes
  ON p.PostTypeId = ptypes.Id
  AND ptypes.Name = 'Question'
  
INNER JOIN PostTags AS ptags
  ON p.Id = ptags.PostId
  
INNER JOIN Tags AS t
  ON t.Id = ptags.TagId
  
INNER JOIN (  

  SELECT TOP 10
  Tag,
  Question_Count

  FROM (
    SELECT
    t.TagName AS Tag,
    COUNT(DISTINCT p.Id) AS Question_Count

    FROM Posts AS p

    INNER JOIN PostTypes as ptypes
      ON p.PostTypeId = ptypes.Id
      AND ptypes.Name = 'Question'

    INNER JOIN PostTags AS ptags
      ON p.Id = ptags.PostId

    INNER JOIN Tags AS t
      ON t.Id = ptags.TagId

      WHERE p.CreationDate BETWEEN '2020-09-01' AND '2020-09-30'

    GROUP BY t.TagName

    ) AS SUB

  ORDER BY Question_Count DESC

) AS Top_Tags
ON Top_Tags.Tag = t.TagName

WHERE p.CreationDate BETWEEN '2020-09-01' AND '2020-09-30'

ORDER BY p.Id

Enter Parameters

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