How Rich Are The 1%?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Occupy Stack overflow!

Anime and Manga

Q&A for anime and manga fans

-- Enter Query Title
-- Enter Query Description

;WITH percentile AS (
SELECT NTILE(100) OVER (ORDER BY Reputation DESC) as p, Reputation, DisplayName
FROM Users
)
SELECT 'The ' + CASE p WHEN 1 THEN '1' ELSE '99' END + '%' AS Who, SUM(Reputation) AS Rep 
FROM percentile
GROUP BY CASE p WHEN 1 THEN '1' ELSE '99' END

Enter Parameters

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