select uid, date_format(dt,'%Y%m') as month, sum(day_coin) as coin from (select uid,dt, case (rk1%7) when 3 then 3 when 0 then 7 else 1 end as day_coin from (select t1.*, row_number() over(partition by uid,date_sub(dt,interval rk day) order by dt) rk1 from (select distinct uid,date(in_time) as dt, d...