![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hive
文章平均质量分 51
卡卡是个胖子
哦。。
展开
-
HiveSQL找出连续日期及连续的天数(方法二)
经常遇到统计连续行为日期及连续天数的问题,之前的解决方案相对复杂,本次给出最简单的解决方案。1、测试数据:use xxx;drop table test_serialdate;create table if not exists test_serialdate ( user_id string comment '用户ID', sign_date string comment '签到日期' ) stored as orcfile; insert into table test原创 2022-05-27 20:02:18 · 2833 阅读 · 1 评论 -
HiveSQL找出连续日期及连续的天数
参考:https://www.cnblogs.com/Joetao/p/3842242.html参考关键代码:select 本期起始日期=min(rq),本期终止日期=max(rq), 持续天数=max(id1)-min(id1)+1, 距上一期天数=case a.id1-a.id2 when -1 then 0 else max(datediff(d,rq2...原创 2019-01-06 10:58:45 · 8066 阅读 · 0 评论