Top users per tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for for those using, extending or developing emacs

-- Top users per tag

declare @tag_id int = (select id from tags where tagname = ##Technology:string##);

--select rank() over (order by score desc) "Rank", * from (
select
  rank() over (order by sum(answers.score) desc) "Rank",
  u.id "User Link"
  ,sum(answers.score) as "Score"
from users u
join posts answers on (u.id = answers.owneruserid)
join posts parent on (answers.parentid = parent.id)
join posttags on (parent.id = posttags.postid)
where posttags.tagid = @tag_id
and upper(u.location) like upper('%' + ##Location:string## + '%')
and answers.posttypeid = 2  -- answers only
group by u.id
order by sum(answers.score) desc
;

Enter Parameters

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