with new as ( select user_id,min(date) nu from login group by user_id--找出新用户 ), jg as ( select new.nu,lo.user_id,lo.client_id,lo.date da,datediff(lo.date,new.nu) df--输出时间间隔,这里0表示用户当天登录的日期行,1为次日登录的日期行,以此类推。。。。 ,sum(if(datediff(lo.date,new.nu)=1,1,0))over(partition by user_id) dt--这里比较重要,在...