Get all comments for a specified user in a descending order by Score

2

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

-- Input: UserId (taken from the URL when you are on your profile)
-- Output: Score, link to comment, link to post, Text, CreationDate, link to user

DECLARE @UserId int = ##UserId##

SELECT 
  c.Score, 
  c.Id as [Comment Link],
  p.Id as [Post Link],
  c.Text,
  c.CreationDate,
  c.UserId as [User Link]
FROM 
  Comments c, Posts p
WHERE
  p.Id = c.PostId AND
  c.UserId = @UserId
ORDER BY
  c.Score DESC

Enter Parameters

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