Average number of answers depending on the total amount of bounties on the question

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

;with bounties_cte AS (
SELECT 
  SUM(bs.BountyAmount) AS Amount,
  p.Id AS pid,
  p.AnswerCount AS ac
FROM Posts p INNER JOIN Votes bs ON p.Id = bs.PostId
WHERE bs.VoteTypeId = 8  -- BountyStart
GROUP BY p.Id, p.AnswerCount)


SELECT 
  Amount,
  AVG(CAST(ac AS decimal)) AS [Average Number of answers]
FROM bounties_cte
GROUP BY Amount
ORDER BY Amount

Enter Parameters

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