当前位置:网站首页>Find out the users who log in for 7 consecutive days and 30 consecutive days
Find out the users who log in for 7 consecutive days and 30 consecutive days
2022-06-28 19:01:00 【South Lake Fishing Song】
Little red book written test , Telecom cloud interview :
/* use dw; SELECT * from fct_sales fs limit 10; SELECT min(dimDateID) , max(dimDateID) from fct_sales fs limit 10; -- 20170602 20170830 */
select * ,count(1)over() as cnt
from
(
select user_id
,dts
,count(1) as num
from
(
select user_id
,date_sub(log_in_date, interval ranks day) dts
from
(
SELECT user_id
,log_in_date
,row_number()over(partition by user_id order by log_in_date asc) as ranks
from (
select DISTINCT dimMemberID as user_id, date(dimDateID) as log_in_date
from fct_sales
where timestampdiff(day, date(dimDateID),(select max(dimDateID) from fct_sales)) <= 30
and dimMemberID <> 0
) data_source
) t
) a
group by user_id,dts
) b
where num in (7,30);
边栏推荐
- 手动备份和还原DHCP服务器
- Business layer modification - reverse modification based on the existing framework
- 技术管理进阶——管理者如何做绩效沟通及把控风险
- 上传文件列表(文件名重复加括号标识)
- Graduation project - Design and development of restaurant management game based on unity (with source code, opening report, thesis, defense PPT, demonstration video and database)
- Openharmony - detailed source code of Kernel Object Events
- Upload file list (repeated file names are marked with brackets)
- ANR Application Not Responding
- Anonymous function variable problem
- 毕业设计-基于Unity的餐厅经营游戏的设计与开发(附源码、开题报告、论文、答辩PPT、演示视频,带数据库)
猜你喜欢
随机推荐
MongoDB系列之MongoDB工作原理简单介绍
sql计算每日新增用户、及留存率指标
OOM out of memory 内存溢出
About Critical Values
进阶高级-业务事务设计 开发入门
AOSP Tsinghua image download error resolution
Understanding of closures
带你手把手实现grafana双轴图
Opencv中使用Tracker实现物体跟踪
3D rotatable particle matrix
grafana绘制走势图
Shell unknown rollup 1
Advanced - Introduction to business transaction design and development
【Unity3D】相机跟随
基于管线的混合渲染
postgresql数据库docker
tensorboard 使用总结
【Unity3D】发射(RayCast)物理射线(Ray)
618活动季——百数低代码平台特享折扣来临
Question brushing analysis tool









