当前位置:网站首页>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);
边栏推荐
- Advanced technology management - how managers communicate performance and control risks
- devpi
- POI excel conversion tool
- 19.2 container classification, array and vector container refinement
- 浅谈软件研发的复杂性与效能提升之道
- AOSP Tsinghua image download error resolution
- Business layer modification - reverse modification based on the existing framework
- leetcode 1647. Minimum deletions to make character frequencies unique
- Record an emotet Trojan horse handling case
- Taishan Office Technology Lecture: word strange font height
猜你喜欢
随机推荐
Shell unknown rollup 1
【Unity3D】相机跟随
Business layer modification - reverse modification based on the existing framework
Native implementation Net5.0+ custom log
1 invalid import format(s) Postman Collection Format v1 is no longer supported and can not be import
深入解析kubernetes中的选举机制
Openfire 3.8.2集群配置
Record an emotet Trojan horse handling case
百度时间因子添加
模块化操作
Modular operation
Analysis of the core components of mybayis
leetcode 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers(最少的“二进制数“个数)
Hands on Teaching of servlet use (1)
业务层修改--根据现有框架的反推修改
openGauss内核:SQL解析过程分析
About Significance Tests
Cannot read property 'MTJ' of undefined
An in-depth analysis of the election mechanism in kubernetes
Get the timestamp of 0:00 and 23:59 of the current date








