Newer users with higher rep

0

Please login or register to vote for this query.

(click on this box to dismiss)

List users that have been members shorter, but have higher rep than this user. The last Entry will be this user, for comparison

Stack Overflow

Q&A for programmers

-- Newer users with higher rep
-- List users that have been members shorter, but have higher rep than this user.

DECLARE @UserId int = ##UserId##

SELECT 
    u.id as [User Link],
    cast(datediff(day, u.creationDate, current_timestamp) as nvarchar) + ' Days'
      as [Member for],
    u.reputation as [Rep],
    u.reputation - you.reputation as [Rep more than yours],
    (u.reputation / datediff(day, u.creationDate, current_timestamp)) as [Avg rep per Day]
FROM 
    Users u, Users you
WHERE 
    you.Id = @UserId
AND u.creationdate >= you.creationdate
AND
    u.reputation >= you.reputation
ORDER BY 
    u.creationdate DESC

Enter Parameters

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