Top Answerers by Tag in Hungary

1

Please login or register to vote for this query.

(click on this box to dismiss)

Cognitive Sciences Meta

Q&A about the site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry

-- Top users per tag

declare @limit int = 100;
declare @tag_name nvarchar(35) = '##TagName##';
declare @tag_id int = (select id from tags where tagname = @tag_name);

select top (@limit)
  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
and answers.posttypeid = 2  -- answers only
AND (
    LOWER(Location) LIKE '%hungary%'
    OR LOWER(Location) LIKE '%magyarország%'
    OR LOWER(Location) LIKE '%budapest%'
    OR UPPER(Location) LIKE '%HU'
    OR UPPER(Location) LIKE '%hungary%'
    OR UPPER(Location) LIKE '%magyarország%'
    OR UPPER(Location) LIKE '%budapest%'
)
group by users.id
order by sum(answers.score) desc
;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results