Related tag counts

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 T2.TagName, Count(P.Id)
from Posts P
    inner join PostTags PT on PT.PostId = P.Id
    inner join Tags T on T.Id = PT.TagId
    inner join PostTags PT2 on PT2.PostId = P.Id
    inner join Tags T2 on T2.Id = PT2.TagId
where P.PostTypeId = 1
    and T.TagName = ##Tag:String?for-in-loop##
    -- and T2.TagName <> ##Tag##
group by T2.Id, T2.TagName
order by Count(P.Id) desc

Enter Parameters

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