Top users who answered and voted to close (excluding dupes)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select top 1000
  Voter.Id as [User Link],
  count(distinct Question.Id) as [Questions Closed],
  sum(Answer.Score) as [Total Answer Score]
from Users as Voter
join Posts as Answer on Answer.OwnerUserId = Voter.Id
join Posts as Question on Question.Id = Answer.ParentId
join PostHistory as CloseEvent on CloseEvent.PostId = Question.Id 
where Answer.PostTypeId = 2
  and CloseEvent.PostHistoryTypeId = 10
  and CloseEvent.Comment not in ('1', '101') -- not a dupe
  and CloseEvent.CreationDate = Question.ClosedDate
  -- posthistory json hack from https://meta.stackexchange.com/a/234057
  and CloseEvent.Text like '%"Id":'+cast(Voter.Id as nvarchar)+',%'
group by Voter.Id
order by [Questions Closed] desc

Enter Parameters

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