Anton.Sandbox

1

Please login or register to vote for this query.

(click on this box to dismiss)

Code Golf and Coding Challenges Meta

Q&A about the site for programming puzzle enthusiasts and code golfers

/* Count reputation to evaluate Gini
*/

;WITH UsersSample AS
(
  SELECT u.Id
  FROM Users u tablesample(0.01 percent)
  )
SELECT v.VoteTypeId, COUNT(*) as n
FROM Votes v
RIGHT OUTER JOIN Posts p ON p.Id = v.PostId
RIGHT OUTER JOIN UsersSample u ON u.Id = p.OwnerUserId
WHERE v.Id > 0 AND p.OwnerUserId > 0
GROUP BY p.OwnerUserId, v.VoteTypeId
ORDER BY p.OwnerUserId, v.VoteTypeId

Enter Parameters

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