Winning-query-test-1

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
tags_separated,
count(*) as cnt

FROM
  (
  SELECT
      STRING_AGG(t.TagName, ',') WITHIN GROUP (ORDER BY t.TagName) AS tags_separated
  FROM Posts p
  INNER JOIN PostTags pt ON p.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE p.PostTypeId = 1 -- Questions
  GROUP BY p.Id
  ) ts
GROUP BY 
ts.tags_separated

ORDER BY tags_separated DESC

Enter Parameters

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