Пользователи по количеству популярных вопросов

0

Please login or register to vote for this query.

(click on this box to dismiss)

Chess

Q&A for serious players and enthusiasts of chess

SELECT pu.OwnerUserId AS [User Link],
       pu.TotalCount,
       pu.PopularCount,
       pu.PopularCount*1.0/pu.TotalCount AS PopularRatio
FROM
  (SELECT p.OwnerUserId,
          count(1) AS TotalCount,
          sum(CASE
                  WHEN p.ViewCount>=1000 THEN 1
                  ELSE 0
              END) AS PopularCount
   FROM Posts p
   WHERE p.PostTypeId = 1 --Questions
   GROUP BY p.OwnerUserId
   HAVING count(1) >= 10) pu
WHERE pu.PopularCount>0
ORDER BY PopularRatio DESC

Enter Parameters

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