Bounty winners after expiration

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

With OnlyOneBounty as
(SELECT 
    PostID
FROM 
   Votes
WHERE 
   voteTypeID = 8 
GROUP BY 
    PostID
HAVING 
   Count(*) = 1
)

SELECT a.Id [Post Link], 
       v.CreationDate BountyStart, 
       a.CreationDate AnswerDate, 
       v.BountyAmount BountyAmount, 
       answerVote.BountyAmount BountyAmountWon
FROM 
  OnlyOneBounty b
  INNER JOIN Votes v
  ON b.PostId = v.PostID
     and v.voteTypeID = 8
  INNER JOIN Posts a
  ON v.PostID = a.ParentID
  
  INNER JOIN votes answerVote
  ON answerVote.PostID = a.Id

WHERE 
  DateDiff(d, v.CreationDate, a.CreationDate) > 7
  and 
  answerVote.voteTypeID = 9
ORDER BY 
   v.CreationDate

Enter Parameters

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