List the top users by average score (upvotes - downvotes) on answers
Perguntas e respostas para programadores profissionais e entusiastas
-- Top users by average answer score -- List the top users by average score (upvotes - downvotes) on answers DECLARE @MinimumAnswerCount Numeric = 10 SELECT TOP 100 p.OwnerUserId As [User Link], Min(u.Reputation) As [Reputation], Count(*) As [Number of answers], Round(Avg(Convert(Float, p.Score)), 2) As [Average score] FROM Posts p INNER JOIN Users u ON p.OwnerUserId = u.Id WHERE p.PostTypeId = 2 AND p.CommunityOwnedDate IS NULL GROUP BY p.OwnerUserId HAVING Count(*) >= @MinimumAnswerCount ORDER BY [Average score] DESC