Median Reputation for Users that are 10 years on site

0

Please login or register to vote for this query.

(click on this box to dismiss)

Skeptics

Q&A for scientific skepticism

SELECT TOP 15 
   Id
  ,DisplayName
  ,Location 
  ,Reputation
  ,CreationDate
  ,UpVotes 
  ,DownVotes 
  ,RANK() OVER(ORDER BY Reputation) AS rnk 
  ,DENSE_RANK() OVER(ORDER BY Reputation) AS rnk 
  ,PERCENTILE_CONT(0.5) 
   WITHIN GROUP (ORDER BY Reputation)
   OVER (PARTITION BY 1) 
   AS MedianReputation
FROM users
WHERE (1=1) 
-- AND Reputation > 1000 
AND DATEDIFF(year, CreationDate, CURRENT_TIMESTAMP)  = 10
ORDER BY 
     CASE WHEN id = '##UserId##' THEN 0 ELSE 1 END 
    ,Reputation DESC

Enter Parameters

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