Q&A about the site for linguists, teachers and students of the Ukrainian language
DECLARE @tagName nvarchar(35) = '##tagName##' SELECT top 2000 TagName, SUM(case votes.votetypeid WHEN 2 THEN 1 -- upvote WHEN 3 THEN -1 -- downvote END) as Rep, Users.DisplayName as Username, ('https://stackoverflow.com/users/' + CAST (Users.Id AS nvarchar)) as Website, Users.Reputation as Overall_Reputation, Users.Location, rank = ROW_NUMBER() OVER (ORDER BY TagName) FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Users ON Posts.OwnerUserId = Users.Id INNER JOIN Votes ON Votes.PostId = Posts.Id WHERE Tags.TagName = @tagName AND Posts.CommunityOwnedDate IS NULL AND Users.Reputation > 5000 AND upper(users.location) like upper('%' + ##YourLocation:string## + '%') -- uppercase location-- GROUP BY TagName, DisplayName, Location, Users.Id, Users.Reputation ORDER BY Rep DESC