Comments vs. Posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Do I prefer writing comments or posts? Are they relevant?

Computational Science

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) / 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) / COUNT(*) AS AvgScore
FROM
  Posts
WHERE
  Posts.OwnerUserId = @UserId

Enter Parameters

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