Users by total number of favorites on their posts

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

SELECT
  RANK() OVER(ORDER BY SUM(Posts.FavoriteCount) DESC) AS 'no.',
  Posts.OwnerUserId AS [User Link],
  Users.Reputation,
  SUM(Posts.FavoriteCount) AS 'TotalFavorites',
  COUNT(*) AS 'Posts with favorites'
FROM Posts
JOIN Users ON Users.Id = Posts.OwnerUserId
WHERE Posts.OwnerUserId IS NOT NULL
  AND Posts.FavoriteCount>0
  AND Posts.CommunityOwnedDate IS NULL
GROUP BY Posts.OwnerUserId, Users.Reputation
ORDER BY TotalFavorites DESC

Enter Parameters

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