Which tags with at least 1000 question in past 30 days had most duplicates?

1

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

-- Which tags with at least 1000 question in past 30 days had most duplicates?

WITH MyTable AS
  (SELECT Tags.TagName,
          SUM(CASE
                  WHEN TRY_CONVERT(int, PostHistory.Comment) IN (1, 101)
                       AND TRY_CONVERT(int, PostHistory.PostHistoryTypeId) = 10 THEN 1
                  ELSE 0
              END) AS Duplicates,
          COUNT(*) AS Total
   FROM Posts
   INNER JOIN PostHistory ON PostHistory.PostId = Posts.Id
   INNER JOIN PostTags ON PostTags.PostId = Posts.Id
   INNER JOIN Tags ON Tags.Id = PostTags.TagId
   WHERE Posts.PostTypeId = 1
     AND Posts.CreationDate >= DATEADD(DAY, -30, GETDATE())
     AND Posts.CreationDate <= GETDATE()
   GROUP BY Tags.TagName)
SELECT *,
       ROUND(1.0 * Duplicates/Total, 3) AS DuplicatesPerQuestion
FROM MyTable
WHERE Total > 1000
ORDER BY DuplicatesPerQuestion DESC

Enter Parameters

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