Find Questions with Only the Given Tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Returns a list of all questions posted with exclusively the given tag, that is, posts tagged with the given tag and no others.

Philosophy Meta

Q&A about the site for those interested in the study of the fundamental nature of knowledge, reality, and existence

DECLARE @TagId int = (
SELECT
  t.Id
FROM Tags t
WHERE t.TagName = ##TagName:string##
)

SELECT
  CONCAT('site://q/', pt.PostId, '|', p.Title) AS [Post Link],
  p.CreationDate
FROM PostTags pt
JOIN Posts p ON p.Id = pt.PostId
LEFT JOIN PostTags otherTags ON otherTags.PostId = pt.PostId
WHERE pt.TagId = @TagId
GROUP BY pt.PostId, p.Title, p.CreationDate
HAVING COUNT(otherTags.PostId) = 1
ORDER BY p.CreationDate DESC

Enter Parameters

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