Top scoring comments for a user (and whether user owned a Q or A on that thread)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT TOP 2200
            c.Id As [Comment Link]
            , c.Score
            , c.PostId As [Post Link]
            , c.Text
            , c.CreationDate
            , [Posts on that Q&A] = (
                SELECT  COUNT (p.Id)
                FROM    Posts p
                WHERE   p.OwnerUserId = ##UserId##
                AND (
                        p.Id = c.PostId
                        OR
                        p.ParentId = c.PostId
                        OR
                        p.ParentId = (SELECT o.ParentId  FROM Posts o  WHERE o.Id = c.PostId)
                )
            )
FROM        Comments c
WHERE       c.UserId = ##UserId##
ORDER BY    c.Score DESC, c.PostId, c.CreationDate

Enter Parameters

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