Shows your Answers that are in contention for earning the Populist Badge (Highest scoring answer that outscored an accepted answer with score of more than 10 by more than 2x).
Q&A for community managers, administrators, and moderators
SELECT Question.Id AS [Post Link],
MAX(Answers.Score) AS [Highest Score],
AcceptedAnswer.Score AS [Accepted Score],
MyAnswer.Score AS [My Score],
DECIMAL( 4, 2 ),
CAST( MyAnswer.Score AS FLOAT ) / AcceptedAnswer.Score
) AS [Score Ratio],
(( AcceptedAnswer.Score * 2 ) - MyAnswer.Score ) AS [Votes Needed]
FROM Posts Question
JOIN Posts Answers ON Question.Id = Answers.ParentId
JOIN Posts MyAnswer ON Answers.OwnerUserId = ##UserId##
JOIN Posts AcceptedAnswer ON Question.AcceptedAnswerId = Answers.Id
WHERE AcceptedAnswer.OwnerUserId != ##UserId## -- My answer is not the accepted answer.
AND AcceptedAnswer.Score > 10 -- Accepted answer has more than 10 votes.
AND MyAnswer.Score = -- My answer has the most votes.
WHERE ParentId = Question.Id
-- AND [Score Ratio] > 2.0 -- My answer outscored the accepted by more than 2x.
GROUP BY Question.Id, Answers.Score, AcceptedAnswer.Score, MyAnswer.Score
ORDER BY [Votes Needed]