select user_id,max(cnt) as max_consec_days from( select user_id,sub_result,count(*) cnt from( select user_id,date_sub(fdate,interval rn day) sub_result from( select fdate,user_id,row_number()over(partition by user_id order by fdate)rn from( select fdate,user_id from tb_dau )a )b )c group by user_id,sub_result )d group by user_id



京公网安备 11010502036488号