Test

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select pt.postId, tag.tagname
from (
select p.Id as postId, count(distinct pt.TagId) as tagsNum
from PostTags pt
inner join Posts p on p.Id=pt.postId
group by p.Id
having count(distinct pt.TagId)=1
) t
join PostTags pt on (t.postId=pt.postId)
join Tags tag  on (tag.id=pt.tagId)

Enter Parameters

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