Q&A for spacecraft operators, scientists, engineers, and enthusiasts
;with closevoters_cte AS ( select ph.postid as pid , cv.userid as uid from posts p join posts a on a.parentID = p.Id inner join posthistory ph on ph.PostId=p.Id cross apply OPENJSON(JSON_QUERY(ph.text, '$.Voters')) with (userid int '$.Id') cv where (posthistorytypeid = 10) and a.OwnerUserId = 21813 ) 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