The following pivot query does that for you.
Notice that I didn't do a full/correct reputation calc, just the bits based on voting and neglecting any reputation cap, offered bounties, accepted question. I leave that as an exercise for the reader.
For performance reasons the userid's are scattered around on 3 places. Sorry for that but I didn't fancy making that dynamic.
;with post_rep as
(
select owneruserid
, tagname
, sum(
case posttypeid
when 1 then --Q
case votetypeid
when 2 then 5
when 3 then -2
else 0
end
when 2 then --A
case votetypeid
when 1 then 15
when 2 then 10
when 3 then -2
when 9 then bountyamount
else 0
end
else
0
end
) reputation
from posts p
inner join posttags pt on pt.postid = coalesce(p.parentid, p.id)
inner join tags t on t.id = pt.tagid
inner join votes v on v.postid = p.id
where v.votetypeid in (1,2,3,9)
and owneruserid in (4333347 ,213615)
group by owneruserid
, tagname
)
-- Select Id, Reputation from Users where Id in (4333347,213615)
select tagname, [4333347] ,[213615]
from (
select *
from post_rep
) as pvt
PIVOT
(
sum(reputation) for owneruserid in ([4333347] ,[213615])
) data
order by [4333347] + [213615] desc
When run today this is what the result looks like:
Keep in mind SEDE is updated once a week on Sunday. Give a big shout-out to Monica Cellio for the awesome SEDE Tutorial she wrote. Say "Hi" in SEDE chat.