Virtual Meta Reputation for User X

7

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

SELECT
  -- p.Id AS [Post Link],
  -- v.VoteTypeId,
  SUM(CASE
    WHEN v.VoteTypeId = 1 THEN 15
    WHEN v.VoteTypeId = 2 AND p.PostTypeId = 1 THEN 5
    WHEN v.VoteTypeId = 2 AND p.PostTypeId = 2 THEN 10
    WHEN v.VoteTypeId = 3 THEN -2
  END) AS Reputation,
  COUNT(CASE v.VoteTypeId WHEN 1 THEN 1 END) AS Accepts,
  COUNT(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 1 THEN 1 END) AS QuestionsUpVotes,
  COUNT(CASE WHEN v.VoteTypeId = 2 AND p.PostTypeId = 2 THEN 1 END) AS AnswerUpVotes,
  COUNT(CASE v.VoteTypeId WHEN 3 THEN 1 END) AS DownVotes
FROM Posts p
  INNER JOIN Votes v ON p.Id = v.PostId
  INNER JOIN Users u ON p.OwnerUserId = u.Id
WHERE v.VoteTypeId IN (1,2,3) -- accepts,ups,downs
  AND p.OwnerUserId = ##UserId:int?456814##

Enter Parameters

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