完整代码 SELECT AVG(flag) avg_ret FROM ( SELECT device_id, DATE, ( SELECT IF(COUNT(*)>0,1,0) FROM question_practice_detail qp2 WHERE qp2.device_id = qp1.`device_id` AND datediff(qp2.date, qp1.date)=1 ) as flag -- flag标记的是这个device_id在date日的次日是否会回...