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

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stellar Meta

Q&A about the site for developers and users of Stellar and the Stellar Distributed Exchange

-- 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
JOIN
  Posts p
ON
  p.Id = c.PostId
WHERE
  c.UserId = @UserId
ORDER BY
  c.Score DESC

Enter Parameters

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