---

0

Please login or register to vote for this query.

(click on this box to dismiss)

Reverse Engineering Meta

Q&A about the site for researchers and developers who explore the principles of a system through analysis of its structure, function, and operation

--=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-    --<-- CALCULATE REP BY DAY --<--
select 
v.creationdate as vDate,
  sum(case 
    when v.votetypeid=1 then
      case when p.posttypeid=2 then 15 end             --Accepted Answer
    when v.votetypeid=2 then
      case when p.posttypeid=1 then 5                  --Upvote Question
           when p.posttypeid=2 then 10 end             --Upvote Answer
    when v.votetypeid=3 then -2                        --Downvote Q or A
  end ) as [Rep]
from posts p left outer join votes v on v.postid = p.id 
where p.owneruserid=##UserID:int?22656## and
  v.votetypeid in (1,2,3)                              --Accepted, Upvote, Downvote only
  and p.posttypeid in (1,2)                            --Q or A only
group by p.owneruserid,v.creationdate
/*
insert into #rep select v.creationdate as vDate,       --Calculate rep from Bounty in/out
sum(case when votetypeid=1 then 15 else 0 end) as accepted,
sum(case when votetypeid=8 then 0-v.bountyamount else v.bountyamount end) as bounty
from votes v right join posts p on v.postid =p.id
group by v.creationdate
where votetypeid in (1,8,9) and owneruserid = ##UserID:int?22656## --8=bounty received, 9=bounty paid

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results