Get score by post type for UserName

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

declare @UserId as int
select @UserId = Id From Users where DisplayName = '##UserName##'
Select (Select SUM(Score) From Posts where OwnerUserId = @UserId AND PostTypeId = 2) AS AnswerScore,
(Select SUM(Score) From Posts where OwnerUserId = @UserId AND PostTypeId = 1) AS QuestionScore,
(Select SUM(Score) From Comments where UserId = @UserId) AS CommentScore,
(Select TOP(1) Id From Users where Id = @UserId) As UserId

Enter Parameters

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