User with the Most Favorites

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- User with the Most Favorites

    SELECT TOP 1 COUNT(*) AS favcnt, Votes.UserId  AS [User Link]
    FROM Votes 
      INNER JOIN 
        Users ON Votes.UserId = Users.Id
    WHERE Votes.VoteTypeId = 5
    GROUP BY UserId
    ORDER BY favcnt DESC

Enter Parameters

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