关键逻辑 同一id的日期+1能够找到匹配值,表的自联结,连续两天上线用户数量/全部上线用户数量 两个易错点: date_add(date,INTERVAL 1day) 容易写城day_add 留存率计算无需过滤重复的id SELECT COUNT(t2.device_id)/ COUNT(t1.device_id) FROM (Select DISTINCT device_id, date FROM question_practice_detail) AS t1 LEFT JOIN (Select DISTINCT device_id, date FROM question_practice_...