Most loyal users

2

Please login or register to vote for this query.

(click on this box to dismiss)

Users with highest upvote to downvote ratio.

Stack Overflow на русском

Вопросы и ответы для программистов

select top 500
  row_number() over (order by u.UpVotes * 1.0 / u.DownVotes desc) as '#',
  u.Id as [User Link],
  format(u.UpVotes * 1.0 / DownVotes, 'p') as [Good Ratio],
  u.UpVotes as [Up],
  u.DownVotes as [Down],
  u.Reputation as [Rep],
  u.LastAccessDate as [Last Access],
  (
    select top 4
      t.TagName + ', ' as 'data()'
    from
      Posts as q
    inner join
      Posts as a on a.ParentId = q.Id
    inner join
      PostTags as pt on pt.PostId = q.Id
    inner join
      Tags as t on pt.TagId = t.Id
    where
      a.OwnerUserId = u.Id and a.PostTypeId = 2
    group by
      TagName
    order by
      sum(a.Score) desc
    for xml path('')
  ) + ' ...' as [Top Tags]
from
  Users as u
where
  u.DownVotes > 1 and u.UpVotes > 200
order by
  --u.UpVotes * 1.0 / u.DownVotes desc
  log(u.UpVotes, 2) + log(u.UpVotes * 1.0 / DownVotes, 2) desc

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results