Rep earned on answers to questions closed within a day


Please login or register to vote for this query.

(click on this box to dismiss)

Calculates total reputation earned on answers to questions which were closed within 24 hours of creation for the year of 2013. Reptuation is grouped by user id.

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT      Answers.OwnerUserId
        ,   SUM(
                    WHEN Votes.VoteTypeId = 2 THEN 10
                    WHEN Votes.VoteTypeId = 3 THEN -2
                    ELSE 0
            ) AS EarnedRep
FROM        Posts AS Questions
        ,   Posts AS Answers
        ,   Votes
WHERE       Questions.PostTypeId = 1
        AND Questions.CreationDate BETWEEN '2013-01-01' AND '2013-12-31'
        AND DATEDIFF( HOUR, Questions.CreationDate, Questions.ClosedDate ) < 24
        AND Answers.PostTypeId = 2
        AND Answers.ParentId = Questions.Id
        AND Votes.PostId = Answers.Id
GROUP BY    Answers.OwnerUserId

Enter Parameters

Switch to meta site
loading Hold tight while we fetch your results