0 点赞 评论 收藏
分享
0 点赞 评论 收藏
分享
0 点赞 评论 收藏
分享
2021-12-14 13:07
同济大学 数据分析师 牛客66014453号:感觉观点不是很对,如果过用户是近7天内的新用户,并且在7天内不止活跃1次!用这个方法就没办法确定用户是“忠实”还是“新晋”!我觉得应该加个条件,判断用户首次活跃的时间在不在7天内,以此来确定是“忠实”还是“新晋” select user_grade,round(count(*)/(select count(distinct uid) from tb_user_log),2) as ratio from (select uid, (case when gap<7 and datediff((select max(in_time) from tb_user_log),start_time)>=7 then '忠实用户' when gap<7 and datediff((select max(in_time) from tb_user_log),start_time)<7 then '新晋用户' when gap>=7 and gap<30 then '沉睡用户' when gap>=30 then '流失用户' end) as user_grade from (select uid,datediff((select max(in_time) from tb_user_log),max(in_time)) as gap, min(date(in_time)) as start_time from tb_user_log group by uid) t1) t2 group by user_grade order by ratio desc;
0 点赞 评论 收藏
分享
关注他的用户也关注了: