I want to be able to compare the activity of StackOverflow users, but comparing two users with a year and ten years of experience by their reputation does not seem entirely indicative.
That's why I want to compare the reputation of users received only for questions and answers that are not older than 365 days.
Please help me compose a query that will return the user's reputation received for questions asked in the last 365 days and answers given in the last 365 days.
Many thanks to @rene for his ideas in the comments to the question.
Here is the query that calculates the user's reputation for posts no older than 365 days.
select posts.owneruserid [User Link]
, sum( case votes.votetypeid
when 1 then 15
when 2 then 10
when 3 then -2
else 0
end
) [estimated rep.]
from posts
inner join votes on votes.postid = posts.id
where posts.creationdate > dateadd(dd, -365, getdate())
and posts.owneruserid = ##userId##
group by posts.owneruserid