Find top N users that answered to questions by tag and location. Example: Find top 10 users with tag "python" located in "Boston"
Q&A about the site for expert genealogists and people interested in genealogy or family history
DECLARE @NumberOfRows int = ##NumberOfRows## SELECT DISTINCT TOP (@NumberOfRows) u.Id AS [User Link], u.Reputation AS Reputation, u.Location AS Location, u.AboutMe AS About, p.Id AS [Post Link], p.ViewCount AS Views, p.Tags AS Tags, c.Score AS Comment_Score FROM Users u JOIN Comments c ON c.UserId = u.Id JOIN Posts p ON p.Id = c.PostId --JOIN PostTags pt ON pt.PostId = p.Id --JOIN Tags t ON t.Id = pt.TagId WHERE u.Location LIKE ##UserLocation:string## AND p.PostTypeId = 2 ORDER BY c.Score DESC -- NumberOfRows: Number of Records -- UserLocation: Location