15

0

Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

declare @recentDaysExcluded int = 30

select
  i.VoteDate [Date],
  max(i.Upvotes) [Upvotes]
from (  
  select  
    v.CreationDate [VoteDate],
    ROW_NUMBER() OVER (ORDER BY v.CreationDate) [Upvotes]
  from 
    votes v 
  inner join 
    Posts p 
  on v.PostId=p.id 
  where 
    p.OwnerUserId=##UserId## 
    and v.VoteTypeId = 2
    and datediff(day, p.CreationDate, v.CreationDate) > @recentDaysExcluded
    and p.PostTypeId = 2
) i group by i.VoteDate order by i.VoteDate

Enter Parameters

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