Q&A about the site for academics and those enrolled in higher education
---the cte is taken from here: ---https://data.stackexchange.com/mathoverflow/query/825824/close-voters-on-question ;with closevoters_cte AS ( select postid as pid , crt.name , cv.userid as uid from posthistory ph inner join closereasontypes crt on crt.id = comment cross apply OPENJSON(JSON_QUERY(ph.text, '$.Voters')) with (userid int '$.Id') cv where (posthistorytypeid = 10) and (comment in (1,101)) ) SELECT TOP(##num?500##) RANK() OVER(ORDER BY Count(pid) DESC) AS Rank, uid AS [User Link], COUNT(pid) AS [Count] FROM closevoters_cte GROUP BY uid ORDER BY COUNT(pid) DESC