User with the Most Favorites

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

-- User with the Most Favorites

select top 1 * from (
    SELECT COUNT(*) AS favcnt, Votes.UserId 
    FROM Votes 
      INNER JOIN 
        Users ON Votes.UserId = Users.Id
    WHERE Votes.VoteTypeId = 5
    GROUP BY UserId
    )
    subq

Enter Parameters

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