WITH cte AS (SELECT Id, Title, PostTypeId, Score, MAX(Sco...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics Meta

Q&A about the site for people studying math at any level and professionals in related fields

WITH cte AS (SELECT 
Id,
Title,
PostTypeId,
Score,
MAX(Score) OVER(PARTITION BY PostTypeId) AS MaxScoreByType,
RANK() OVER(PARTITION BY PostTypeId ORDER BY Score DESC) AS Rank
FROM Posts )

SELECT cte.Id,
cte.Title,
cte.PostTypeId,
cte.Score,
cte.MaxScoreByType,
cte.Rank,
PERCENT_RANK()OVER(ORDER BY Rank DESC) AS Pct
FROM cte
ORDER BY RANK DESC

Enter Parameters

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