Top 9 tags used alongside given tag ID

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

SELECT TOP(10) tt.TagName, COUNT(pp.TagID) [Count]
FROM PostTags pp
INNER JOIN (
  (SELECT  pt.PostID
    FROM PostTags pt
    INNER JOIN (
      SELECT t.ID, t.TagName 
      FROM Tags t
      WHERE t.ID = 591
    ) q on q.ID = pt.TagID)
) s ON s.PostID = pp.PostID
INNER JOIN Tags tt ON tt.ID = pp.TagID


GROUP BY tt.TagName
ORDER BY COUNT(pp.TagID) DESC

Enter Parameters

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