This query fetches the top 100 users on a given tag name. The original query is available here: data.stackexchange.com/stackoverflow/s/1791
Q&A about the site for teachers and students of the Esperanto language
-- Top 100 users in a given tag (TeX version) -- This query fetches the top 100 users on a given tag name. The original -- query is available here: data.stackexchange.com/stackoverflow/s/1791 DECLARE @TagName nvarchar(25) = ##Tag:string## SELECT TOP 100 u.Id as [User Link], COUNT(*) AS UpVotes FROM Tags t with (nolock) INNER JOIN PostTags pt with (nolock)ON pt.TagId = t.id INNER JOIN Posts p with (nolock) ON p.ParentId = pt.PostId INNER JOIN Votes v with (nolock) ON v.PostId = p.Id and v.VoteTypeId = 2 inner join Users u with (nolock) on u.Id = p.OwnerUserId WHERE p.CommunityOwnedDate IS NULL and t.TagName = @TagName GROUP BY u.Id ORDER BY UpVotes DESC