当前位置:网站首页>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);
边栏推荐
- PostgreSQL database docker
- G 双轴图sql脚本
- ONEFLOW source code parsing: automatic inference of operator signature
- leetcode 1689. Partitioning into minimum number of deci binary numbers
- Modular operation
- Huawei cloud AOM released version 2.0, and three features appeared
- Tensorboard Usage Summary
- Yixin Huachen: real estate enterprises want to grasp the opportunity of the times for digital transformation
- Opencv中使用Tracker实现物体跟踪
- 推荐两款超高质量的壁纸软件
猜你喜欢
随机推荐
手动备份和还原DHCP服务器
About Significance Tests
⼤⼚⾯试真题集合
G 双轴图sql脚本
Get the timestamp of 0:00 and 23:59 of the current date
Analysis of the core components of mybayis
1 goal, 3 fields, 6 factors and 9 links of digital transformation
leetcode 1423. Maximum points you can obtain from cards
Memory leak
Cannot read property 'MTJ' of undefined
sql计算每日新增用户、及留存率指标
使用Karmada实现Helm应用的跨集群部署
Hands on Teaching of servlet use (1)
ANR Application Not Responding
Render function parsing
FFmpeg学习总结
使用.NetCore自带的后台作业,出入队简单模拟生产者消费者处理请求响应的数据
实时Transformer:美团在单图像深度估计上的研究
AOSP Tsinghua image download error resolution
模块化操作









