Min, max, and average of score to view count ratios per question over a given year

0

Please login or register to vote for this query.

(click on this box to dismiss)

thanks to http://data.stackexchange.com/stackoverflow/s/1506/average-answer-score

Stack Overflow

Q&A for professional and enthusiast programmers

-- Min, max, and average of score to view count ratios per question over a given year
-- thanks to http://data.stackexchange.com/stackoverflow/s/1506/average-answer-score

SELECT
MIN(cast(Score as decimal)/cast(viewcount as decimal)) AS "Minimum",
MAX(cast(Score as decimal)/cast(viewcount as decimal)) AS "Maximum",
(SUM(cast(Score as decimal)/cast(viewcount as decimal)) + 0.0) / Count(*) AS "Average"

FROM posts

WHERE
creationdate >= cast(##year:int## as char) + '-01-01'
and creationdate < cast((##year:int## + 1) as char) + '-01-01'
and posttypeid = 1

Enter Parameters

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