Recent Comments

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

DECLARE @UserId INT = ##UserId:INT##

SELECT 

    --Top 30

    ROW_NUMBER() OVER (ORDER BY c.CreationDate DESC) AS 'ID',
    c.PostID [Post Link],
    c.PostId,
    p.ParentId,
    u.DisplayName AS 'User',
    u.Reputation AS 'Reputation',
    IIF(p.PostTypeId = 1, p.Title, a.Title) AS 'Title',
    p.CommentCount AS 'Comments',
    IIF(p.PostTypeId = 1, 'Q', 'A') AS 'QA',
    c.Score AS 'Score',
    c.CreationDate 'Date',
    c.Text AS 'Comment'

FROM Comments AS c
JOIN Posts AS p ON p.Id = c.PostId
JOIN Users AS u ON u.Id = p.OwnerUserId
LEFT JOIN Posts AS a ON p.ParentId = a.Id

WHERE c.UserId = @UserId

ORDER BY c.CreationDate DESC

Enter Parameters

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