15

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla Meta

Q&A about the site for Joomla! administrators, users, developers and designers

declare @recentDaysExcluded int = 40

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