Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language
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;