1.提取uid,日期,和不同uid对应的日期排名,注意筛选条件 2.根据上表将同一UID,且日期连续的进行分组,进行计算,得到每一组的具体硬币情况 3.进行汇总,按照uid和月份分组。 select uid,date_format(dt,"%Y%m") as month,sum(coin) from (select uid,date_sub(dt,interval rk-1 day) as first_day, case dense_rank()over(partition by uid,date_sub(dt,interval rk-1 day) order by dt)%7 when 0 ...