WITH Scores AS ( SELECT PostTypes.Name AS Type, PostsWith...

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

WITH Scores AS (
  SELECT PostTypes.Name AS Type, PostsWithDeleted.Id, CreationDate, Score
  FROM PostsWithDeleted
  INNER JOIN PostTypes ON PostTypeId=PostTypes.Id
  WHERE OwnerUserId=54957
  UNION ALL
  SELECT N'Comment', PostId, CreationDate, Score
  FROM Comments
  WHERE UserId=54957
)
SELECT Type, P2.Title, Scores.CreationDate, Scores.Score
FROM Scores
INNER JOIN PostsWithDeleted AS P1 ON Scores.Id=P1.Id
INNER JOIN PostsWithDeleted AS P2 ON COALESCE(P1.ParentId, P1.Id)=P2.Id
ORDER BY Scores.CreationDate

Enter Parameters

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