Preguntas y respuestas sobre el sitio para programadores y profesionales de la informática
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##