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

3

Please login or register to vote for this query.

(click on this box to dismiss)

Ebooks

Q&A for ebook publishers and readers

-- 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 to meta site
loading Hold tight while we fetch your results