Reputation for old questions/answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

See http://meta.stackoverflow.com/questions/94852/what-could-increase-the-upvotes-on-old-answers-i-am-getting/94888#94888. This is the base query, which does a similar listing like the one on the user page, but only for older questions and answers. I'll add an aggregate one, too.

Moderators

Q&A for community managers, administrators, and moderators

-- Reputation for old questions/answers
-- See http://meta.stackoverflow.com/questions/94852/what-could-increase-the-upvotes-on-old-answers-i-am-getting/94888#94888.
-- 
-- This is the base query, which does a similar listing like the one on the user page, but only for older questions and answers. I'll add an aggregate one, too.

with oldVotes as (
select p.PostTypeID as postType,
 v.VoteTypeID as voteType,
 v.ID as voteID,
 p.ID as postID,
 p.CreationDate as pDate,
 v.CreationDate as vDate,
 case p.postTypeID
 when 1 then
  -- question
    case v.voteTypeID
      when 2 then 5  -- upvote
      when 3 then -2 -- downvote
      else 0
    end
 when 2 then
  -- answer
    case v.voteTypeID
      when  1 then 15 -- accepted
      when  2 then 10 -- upvote
      when  3 then -2 -- downvote
      else  0
    end
 end as rep,
 Datediff(day, p.CreationDate, v.CreationDate) as ddiff
from votes as v
 join posts as p
 on v.PostId = p.Id
where p.OwnerUserId = '##userId##'
  and v.votetypeid in (1, 2, 3)
  and Datediff(day, p.CreationDate, v.CreationDate) >  ##minimalDistance##
)
select  
  count(o.voteID) as vCount,
  sum(o.rep) as rep,
  postID,
  year(o.vDate)+'-'+month(o.vDate)+'-'+day(o.vDate) as fDate,
  vdate
 from oldVotes o
group by postID, vDate
order by o.vDate

Enter Parameters

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