# 当天新用户
hive -e \'select count(1) from hm2.daily_helper \
where guid not in (select guid from hm2.history_helper);\' > %s'%(resultPath)
(status,result) = execHive(cmd)
# 次日活跃留存
hive -e \'select count(1) from\
(select guid from hm2.helper where dt = "%s" group by guid) yes\
inner join\
(select guid from hm2.helper where dt = "%s" group by guid) today\
where yes.guid = today.guid;\'
1、连续登陆的三天数和以上的用户案例分析
这个问题可以扩展到很多相似的问题:连续几个月充值会员、连续天数有商品卖出、连续打滴滴、连续逾期。
测试数据:用户ID、登入日期
| u |
本文探讨了如何使用SQL进行连续登陆、日活用户、蚂蚁森林排名等统计分析,涉及lead和lag函数的环比计算,以及sql按时间分组、TopN选择等问题。还介绍了应对数据倾斜和大数据量查询的优化策略。
订阅专栏 解锁全文
2909

被折叠的 条评论
为什么被折叠?



