SELECT DISTINCT U.UserId AS UserID, P.Id AS PostID, T.Tag...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Skeptics

Q&A for scientific skepticism

SELECT
    DISTINCT U.UserId AS UserID,
    P.Id AS PostID,
    T.TagName AS PostTag
FROM
    (
        SELECT
            UserId,
            PostId
        FROM
            Comments
        WHERE
            UserId IS NOT NULL

        UNION

        SELECT
            OwnerUserId AS UserId,
            Id AS PostId
        FROM
            Posts
        WHERE
            OwnerUserId IS NOT NULL
    ) U
JOIN
    Posts P ON U.PostId = P.Id
LEFT JOIN
    PostTags PT ON P.Id = PT.PostId
LEFT JOIN
    Tags T ON PT.TagId = T.Id
WHERE
    U.UserId IS NOT NULL;

Enter Parameters

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