C++ needs a legal team.

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

-- Produces a histogram counting which tags people use in conjunction
-- with [language-lawyer].
-- Overwhelmingly, language lawyer posts are also tagged [c++], [c++11], and [c]
SELECT
    NeighbouringTag.TagId,
    NeighbouringTag.TagName,
    COUNT(NeighbouringTag.TagId) as TagCount
From (
    -- Selects all tags of all posts that are tagged 'language-lawyer'
    SELECT -- TOP 100
        Posts.Title,
        Tags.Id,
        Tags.TagName
    FROM Posts
        INNER JOIN PostTags ON PostTags.PostId = Posts.Id
        INNER JOIN Tags ON PostTags.TagID = Tags.Id
    WHERE Posts.Id IN 
        (
            -- Selects all post Ids of posts that are tagged 'language-lawyer'
            SELECT -- TOP 100
                Posts.Id
            FROM Posts
                INNER JOIN PostTags ON PostTags.PostId = Posts.Id
                INNER JOIN Tags     ON PostTags.TagId  = Tags.id
            WHERE
                Tags.TagName = 'language-lawyer'
        )
    --GROUP BY Tags.TagName
    --AND Tags.TagName <> 'language-lawyer'SELECT
) NeighbouringTag(PostTitle, TagId, TagName)
GROUP BY NeighbouringTag.TagId, NeighbouringTag.TagName
ORDER BY TagCount DESC

Enter Parameters

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