当前位置:网站首页>每日sql -用户两天留存率
每日sql -用户两天留存率
2022-08-11 05:35:00 【吃再多糖也不长胖】
用户两天留存率
数据列:
id device_id quest_id result date
select count(date2) / count(date1) as avg_ret
from
(select distinct d1.device_id, d1.date as date1, d2.date as date2
from question_practice_detail d1
left join(
select distinct device_id, date
from question_practice_detail) d2
on d1.device_id = d2.device_id
and date_add(d1.date, interval 1 days) = d2.date
)a
select avg(if(datediff(date2,date1)= 1,1,0)) as avg_ret
from(
select distinct device_id,date as date1,lead(date) over(partition by device_id order by date) as date2
from (select distinct device_id,date from question_practice_detail) b
)a
边栏推荐
猜你喜欢
《Show and Tell: A Neural Image Caption Generator》论文解读
【LeetCode】306.累加数(思路+题解)
HCIP MGRE\OSPF Comprehensive Experiment
Especially the redis
八股文之redis
HCIP MPLS/BGP Comprehensive Experiment
导航定位中的坐标系
图文带你理解什么是Few-shot Learning
CLUSTER DAY03 (Ceph overview, the deployment of Ceph CLUSTER, Ceph block storage)
CLUSTER DAY01 (Introduction to cluster and LVS, LVS-NAT cluster, LVS-DR cluster)
随机推荐
numpy和tensor增加或删除一个维度
xx is not recognized as internal or external command
torch.cat()使用方法
会议OA项目之我的会议
HCIP-BGP的选路实验
windows10安全中心显示“修正未完成”
Memory debugging tools Electric Fence
华为防火墙-5-NAT
抖音API接口
ovnif摄像头修改ip
arcgis填坑_2
ETCD containerized to build a cluster
SATA、SAS、SSD三种硬盘存储性能数据
HCIA实验
Monte Carlo
从mask-rcnn到shp
WiFi Deauth 攻击演示分析 // mdk4 // aireplay-ng// Kali // wireshark //
自定义MVC增删改查
HCIP OSPF/MGRE综合实验
Windos10专业版开启远程桌面协助