Find lonely tags


Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

declare @tagName varchar(25) = ##TagName:string##
SELECT SingleTagQs.Id AS [Post Link]
FROM ( ( SELECT Posts.Id ,
                COUNT( PostTags.TagId ) AS TagCount
         FROM Posts
         JOIN PostTags
         ON Posts.Id = PostTags.PostId
         GROUP BY Posts.Id
         HAVING COUNT( PostTags.TagId ) = 1 ) AS SingleTagQs
       JOIN PostTags
       ON SingleTagQs.Id = PostTags.PostId )
ON PostTags.TagId = Tags.Id
WHERE Tags.TagName = @tagName
-- and Posts.ClosedDate is null

Enter Parameters

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