Top users - per tag and location

0

Please login or register to vote for this query.

(click on this box to dismiss)

スタック・オーバーフロー

プログラマーとプログラミングに熱心な人々のための質問と回答

SELECT TOP(##num?100##)
  RANK() OVER(ORDER BY SUM(a.Score) DESC) AS Rank,
  a.OwnerUserId,
  a.OwnerDisplayName,
  SUM(a.Score) AS [Total Score],
  'site://users/' + CAST(a.OwnerUserId AS varchar) AS [Link]
FROM Posts q INNER JOIN Posts a ON a.ParentId=q.Id
   INNER JOIN PostTags pt ON q.Id = pt.PostId
   INNER JOIN Tags t ON pt.TagId = t.Id
   INNER JOIN Users u ON a.OwnerUserId = u.Id
   WHERE (t.TagName='##tagname?set-theory##') 
     AND (u.Location LIKE '%##country?usa##%' COLLATE Latin1_General_CI_AI)
GROUP BY a.OwnerUserId, a.OwnerDisplayName
ORDER BY SUM(a.Score) DESC

Enter Parameters

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