WITH DIS_VOTES AS ( SELECT DISTINCT V.PostID, V.VoteTypeI...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Chess Meta

Q&A about the site for serious players and enthusiasts of chess

WITH DIS_VOTES AS (
SELECT DISTINCT V.PostID, V.VoteTypeId, Count(*) AS 'SUM'
FROM Votes V
GROUP BY V.PostID, V.VoteTypeId
)
SELECT SUB.*
FROM (SELECT DV.PostID
,VT.Name
,DV.SUM
,RANK() OVER(PARTITION BY VoteTypeId ORDER BY DV.SUM DESC) AS VOTE_RANK
FROM DIS_VOTES DV
INNER JOIN VoteTypes VT ON VT.Id = DV.VoteTypeId
WHERE VT.Name IN ('UpMod','DownMod')) SUB
WHERE SUB.VOTE_RANK <= 10

Enter Parameters

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