Do I prefer writing comments or posts? Are they relevant?
Q&A for scientists using computers to solve scientific problems
-- What score do I have on comments? -- What score do I have on posts? -- How many comments did I write? -- How many posts did I write? DECLARE @UserId int = ##UserId## SELECT 'Comments' AS Label, COUNT(*) AS Number, SUM(Comments.Score) AS TotalScore, SUM(Comments.Score) / CONVERT(float, COUNT(*)) AS AvgScore FROM Comments WHERE Comments.UserId = @UserId UNION SELECT 'Posts' AS Label, COUNT(*) AS Number, SUM(Posts.Score) AS TotalScore, SUM(Posts.Score) / CONVERT(float, COUNT(*)) AS AvgScore FROM Posts WHERE Posts.OwnerUserId = @UserId