WITH posts_avg AS ( SELECT COUNT(*) / COUNT(DISTINCT(Owne...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH
posts_avg AS
(
    SELECT COUNT(*) / COUNT(DISTINCT(OwnerUserId)) AS avp
    FROM Posts
)

SELECT TOP 50
   u.Id,
   u.DisplayName,
   u.Reputation,
   count(*) as [Total Number of Posts],
   POWER(
     u.Reputation/count(*),
     POWER(count(*), 0.25) / pa.avp
   )AS Ratio
FROM Users u
JOIN Posts p on p.OwnerUserId = u.Id
JOIN posts_avg pa ON 1 = 1
where p.postTypeId in (1,2)
group by u.Id, u.DisplayName, u.Reputation, pa.avp
ORDER BY Ratio DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results