View percentiles for bountied 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

WITH 

BountiedPosts AS (
    SELECT p.*
    FROM   Posts p
           JOIN Votes v ON v.PostId = p.Id AND v.VoteTypeId = 8
    WHERE  p.Score >= 0
           AND ClosedDate IS NULL
),

Percentiles AS (
    SELECT NTILE(100) OVER(ORDER BY ViewCount) AS Percentile, 
           ViewCount
    FROM   BountiedPosts
)

SELECT MIN(ViewCount) NumberOfViews, Percentile
FROM   Percentiles
GROUP BY Percentile
ORDER BY Percentile

Enter Parameters

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