Find lonely tags

1

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 )
JOIN Tags
ON PostTags.TagId = Tags.Id
WHERE Tags.TagName = @tagName
-- and Posts.ClosedDate is null

Enter Parameters

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