Passive answer reputation per month

3

Please login or register to vote for this query.

(click on this box to dismiss)

Reputation earned per month from questions at least 10 days old at the time of vote. (Use the graph tab!)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

declare @recentDaysExcluded int = 10

select  
cast(
      cast(DATEPART(YYYY, v.CreationDate) as varchar) 
      + '-' 
      + cast(DATEPART(MM, v.CreationDate) as varchar) 
      + '-01'
    as datetime) [Month],
sum(case when v.VoteTypeId = 2 then 10 else -2 end) as [Passive Reputation]
from 
  votes v 
inner join 
  Posts p 
on v.PostId=p.id 
where 
  p.OwnerUserId=##UserId## 
  and v.VoteTypeId in (2,3)
  and datediff(day, p.CreationDate, v.CreationDate) > @recentDaysExcluded
  and p.PostTypeId = 2
group by 
  DATEPART(Year, v.CreationDate), 
  DATEPART(Month, v.CreationDate)
order by 
  [Month] ASC

Enter Parameters

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