当前位置:网站首页>找出连续7天登陆,连续30天登陆的用户
找出连续7天登陆,连续30天登陆的用户
2022-06-28 18:39:00 【南湖渔歌】
小红书笔试,电信云面试:
/* 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);
边栏推荐
猜你喜欢

3D可旋转粒子矩阵

浅谈软件研发的复杂性与效能提升之道

Summary of the use of qobjectcleanuphandler in QT

Business layer modification - reverse modification based on the existing framework

刷题分析工具

Chapter 2 processing files, cameras and GUI Cameo applications

Alist+RaiDrive 给电脑整个80亿GB硬盘

牛津大学教授Michael Wooldridge:AI社区近40年如何看待神经网络

数字化转型的1个目标,3大领域,6大因素和9个环节

Openharmony - detailed source code of Kernel Object Events
随机推荐
Openfire 3.8.2集群配置
使用.NetCore自带的后台作业,出入队简单模拟生产者消费者处理请求响应的数据
CVPR2022 | 浙大、蚂蚁集团提出基于标签关系树的层级残差多粒度分类网络,建模多粒度标签间的层级知识
curl: (56) Recv failure: Connection reset by peer
Operations research note
推荐两款超高质量的壁纸软件
数字化转型的1个目标,3大领域,6大因素和9个环节
解析机器人主持教学的实践发展
About covariance and correlation
独立站卖家如何高效管理复杂的Facebook主页?
SqlTransaction
C语言指针的一些易错点
19.2 container classification, array and vector container refinement
Pipeline based hybrid rendering
被315点名的流氓下载器,又回来了…
Can I open an account today and buy shares today? Is it safe to open an account online?
Qt 中 QObjectCleanupHandler 使用总结
牛津大学教授Michael Wooldridge:AI社区近40年如何看待神经网络
What are the design requirements for PCB layout and wiring?
leetcode 1423. Maximum points you can obtain from cards