SELECT DISTINCT user_id,max(consec_days) over(partition by user_id order by consec_days desc) max_consec_days FROM (SELECT user_id,count(chazhi) consec_days FROM (SELECT user_id,fdate,date_sub(fdate,interval row_number() over(partition by user_id order by fdate) day) chazhi FROM tb_dau where fdate b...