-- 步骤1:筛选2023年1月数据并获取前一天登录日期 WITH login_with_prev AS ( SELECT user_id, fdate, -- 获取同一用户的前一次登录日期 LAG(fdate, 1) OVER (PARTITION BY user_id ORDER BY fdate) AS prev_date FROM tb_dau WHERE fdate BETWEEN '2023-01-01' AND '2023-01-31' ), -- 步骤2:判断当天是否与前一天连续(连续则标记为0,不连续标记为1) consecutive_flags AS ( SELECT us...