select d.user_id,user.name,d.new from ( select c.user_id,c.new from ( select *,rank() over(order by b.new desc) as 'rk' from ( select a.user_id,sum(a.new) as 'new' from ( select *, case when type = 'reduce' ...