WITH Commentators(PostId, UserId, DisplayName) AS ( SELEC...

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

WITH Commentators(PostId, UserId, DisplayName) AS
(
  SELECT
    PostId, UserId, DisplayName
  FROM
    Comments
  JOIN
    Users ON UserId = Users.Id
  GROUP BY
    Comments.PostID, Comments.UserId, DisplayName
)

SELECT
  DISTINCT a.PostId as [Post Link], a.DisplayName, Posts.CreationDate
FROM
  Commentators AS a
JOIN
  Commentators AS b ON a.PostId = b.PostId AND a.DisplayName = b.DisplayName AND a.UserId != b.UserID
JOIN
  Posts ON Posts.Id = a.PostId
WHERE
  Posts.OwnerUserId != a.UserId AND Posts.OwnerUserId != b.UserId
ORDER BY
  Posts.CreationDate DESC

Enter Parameters

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