My top 100 DBA.SE comments (all time) v3

1

Please login or register to vote for this query.

(click on this box to dismiss)

Programming Language Design and Implementation

Q&A for designers and implementers of computer programming languages

DECLARE @userId int = 10044; /* NOTE TO SELF: I'm 159145 on StacKoverflow, but 10044 on DBA-SE. */


SELECT
    COUNT(*) AS TotalCommentCount,
    COUNT( CASE WHEN c.Score = 0 THEN 1 END ) AS [Count 0],
    COUNT( CASE WHEN c.Score = 1 THEN 1 END ) AS [Count 1],
    COUNT( CASE WHEN c.Score = 2 THEN 1 END ) AS [Count 2],
    COUNT( CASE WHEN c.Score = 3 THEN 1 END ) AS [Count 3],
    COUNT( CASE WHEN c.Score = 4 THEN 1 END ) AS [Count 4],
    COUNT( CASE WHEN c.Score > 4 THEN 1 END ) AS [Count 5+]
FROM 
    Comments AS c
WHERE
    c.UserId = @userId;

SELECT
    TOP 100
    c.PostId AS [Post Link],
    c.CreationDate,
    c.Score,
    c.[Text]
FROM 
    Comments AS c
WHERE
    c.UserId = @userId
    AND
    c.Score > 1
ORDER BY
    c.Score DESC;

Enter Parameters

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