with temp as( select ROW_NUMBER() OVER(partition by user_id order by fdate) id,tb_dau.* from tb_dau where fdate between '2023-01-01' and '2023-01-31' ) select user_id,max(consec_days) as max_consec_days from ( select user_id,date2,count(*) as consec_days from ( select *,DATE_SUB(fdate,INTERV...