Questions with only a single tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Statistical Analysis

Q&A for people interested in statistics, machine learning, data analysis, data mining, and data visualization

-- This filters question with only a single tag
-- Not quite sure why 
-- [SELECT * FROM Posts WHERE Tags = 'r']
-- does not work

WITH TagCount AS (
  SELECT COUNT(*) AS TagN, MIN(TagId) AS TagId, PostId
  FROM PostTags
  GROUP BY PostId
  )
, SingleTags AS (
SELECT TagCount.PostId, TagCount.TagId, Tags.TagName
FROM TagCount LEFT JOIN Tags ON TagCount.TagId = Tags.Id
WHERE TagCount.TagN = 1 AND Tags.TagName = '##TagName##'
)
SELECT * FROM SingleTags LEFT JOIN Posts ON SingleTags.PostId = Posts.Id
ORDER BY CreationDate DESC

Enter Parameters

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