Work towards generalist badge.

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

declare @UserId int = 812912;

with top40tags as (select top 40 id, tagname, "count"
                   from tags
                   order by "count" desc),
     scores as (select tagid,
                       sum(case when votetypeid = 2 then 1
                           when votetypeid = 3 then -1
                           else 0 end) as score
                from votes
                inner join posts on posts.id = votes.postid
                inner join posttags on posttags.postid = posts.parentid
                where posts.owneruserid = @userid
                group by tagid)
select row_number() over (order by score desc) as num, tagname, score,
       case when score >= 15 then 'completed' else 'improve' end as status
from top40tags
left join scores on scores.tagid = top40tags.id
-- where score < 15 or score is null
order by score desc, "count" desc

Enter Parameters

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