with TopUsers as ( select top 1000 OwnerUserId UserId fro...

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

with TopUsers as
(
  select top 1000 OwnerUserId UserId
  from Posts
  where PostTypeId=2
  and CreationDate > getdate()-90
  group by OwnerUserId
  order by sum(Score) desc
)
  
select a.OwnerUserId [User Link],
  SUM( iif(q.acceptedanswerid = a.id,15,0) + iif(a.Score > 0, a.Score*10, 0)) [Reputation]
from
  Posts a
  join TopUsers tu on tu.UserId = a.OwnerUserId
  join posts q on a.parentid = q.id
where
  q.closeddate is not null
  and not exists (select 1 from PostHistory where PostId=q.Id and CreationDate=q.ClosedDate and PostHistoryTypeId=10 and Comment in (101,1))
  and (a.Score > 0 or q.AcceptedAnswerId=a.Id)
group by a.OwnerUserId
order by 2 desc

Enter Parameters

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