Users from tags and location by score and reputation

1

Please login or register to vote for this query.

(click on this box to dismiss)

Search users by their score on specific tags and also show their total reputation.

Science Fiction and Fantasy

Q&A for science fiction and fantasy enthusiasts

-- Users from tags by score and reputation

-- Tags parameter should be passed with string values separeted by , and within '
-- e.g.
-- 'reactjs', 'nodejs', 'typescript'

declare @limit int = ##Limit##;


select top (@limit)
  rank() over (order by sum(answers.score) desc) "Rank",
  users.id "User Link",
  sum(answers.score) as "Score",
  users.reputation as "Reputation",
  users.displayName as "Name",
  users.location as "Location",
  users.websiteUrl as "Website url",
  concat('https://stackoverflow.com/users/', users.id) as "User Link"
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 in (select id from tags where tagname in (##Tags##))
and Lower(users.location) in (##Location##)
and answers.posttypeid = 2  -- answers only
group by users.id, users.reputation, users.displayName, users.websiteUrl, users.location
order by sum(answers.score) desc

Enter Parameters

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