First Time Posts that are on bounty questions

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT 
   COUNT( DISTINCT p.id) QuestionWithBounty,
   COUNT( DISTINCT Answer.id)  BountyAnswers,
   SUM(CASE WHEN PostsBeforeBounty.Id is null THEN 1 ELSE 0 END) FirstTimePosts

FROM posts P
  INNER JOIN Votes bStart
  ON p.id = bStart.PostID
    AND bStart.VoteTypeID = 8 
  INNER JOIN Posts Answer
  ON Answer.ParentID = p.ID
    and Answer.CreationDate > bStart.CreationDate --Answers after bount
  LEFT JOIN Posts PostsBeforeBounty
    ON Answer.OwnerUserId = PostsBeforeBounty.OwnerUserID 
      and Answer.CreationDate > PostsBeforeBounty.CreationDate

Enter Parameters

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