Q&A for gamemasters and players of tabletop, paper-and-pencil role-playing games
;with rep as ( select owneruserid , sum( case posttypeid when 1 then score * 5 when 2 then score * 10 else 0 end ) as reputation from posts group by owneruserid ) select id as [User Link] from users u inner join rep r on u.id = r.owneruserid where u.reputation = 1 and r.reputation > u.reputation order by creationdate , lastaccessdate desc select * from users where id = 518227