Q&A for professional and enthusiast programmers
declare @tag_id int = (select id from tags where tagname = LOWER('##TagName##')); select rank() over (order by sum(answers.score) desc) "Rank", users.id "User Link" ,sum(answers.score) as "Score" from users join posts answers on (users.id = answers.owneruserid) join posts parent on (answers.parentid = parent.id) join posttags on (parent.id = posttags.postid) where posttags.tagid = @tag_id group by users.id having sum(answers.score) > 5 order by sum(answers.score) desc;