统计每天回流玩家的数量,(连续7天不登录,7天后登录算回流玩家)
login_date和uid为联合主键
select *,count(1) as 一天内回流玩家的数量 from( select *, lag(login_date,1) over(partition by uid order by login_date asc) as 上次登录日期, timestampdiff(day,lag(login_date,1) over(partition by uid order by login_date asc),login_date) as 登录间隔天数 from login_user) as t where 登录间隔天数>7 group by login_date;