Users with most answers where they closed the question

1

Please login or register to vote for this query.

(click on this box to dismiss)

Italian Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Italian language

;with closevoters_cte AS (
select postid as pid,
     crt.name,
     cv.userid as uid,
     ph.Id as phid
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
)


SELECT TOP(##num?500##)
RANK() OVER(ORDER BY COUNT(a.Id) DESC) AS [Rank],
COUNT(a.Id) AS [Count],
a.OwnerUserId AS [User Link], a.OwnerDisplayName
FROM Posts q INNER JOIN Posts a ON a.ParentId=q.Id
  INNER JOIN PostHistory ph ON ph.PostId=q.Id
  INNER JOIN closevoters_cte cv ON cv.phid=ph.Id
WHERE (q.ClosedDate IS NOT NULL) AND (ph.PostHistoryTypeId=10) AND (cv.uid=a.OwnerUserId)
GROUP BY a.OwnerUserId, a.OwnerDisplayName
ORDER BY COUNT(a.Id) DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results