当前位置:网站首页>每日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
边栏推荐
- cloudreve使用体验
- AUTOMATION DAY07 (Ansible Vault, ordinary users use ansible)
- SECURITY DAY06 ( iptables firewall, filter table control, extended matching, typical application of nat table)
- xx is not recognized as internal or external command
- vnc remote desktop installation (available for personal testing on 2021-10-20)
- iptables的状态
- CLUSTER DAY03 (Ceph overview, the deployment of Ceph CLUSTER, Ceph block storage)
- uboot sets the default bootdelay
- My meeting of the OA project (meeting seating & review)
- HCIP MGRE\OSPF Comprehensive Experiment
猜你喜欢
随机推荐
Raspberry Pi set static IP address
升级到Window11体验
FusionCompute8.0.0实验(0)CNA及VRM安装(2280v2)
空间金字塔池化 -Spatial Pyramid Pooling(含源码)
radix-4 FFT 原理和C语言代码实现
OA项目之项目简介&会议发布
利用opencv读取图片,重命名。
SECURITY DAY05 (Kali system, scanning and caught, SSH basic protection, service SECURITY)
华为防火墙-1-安全区域
iptables入门
训练分类器
vnc remote desktop installation (available for personal testing on 2021-10-20)
图文带你理解什么是Few-shot Learning
SECURITY DAY03 (one-click deployment of zabbix)
HCIP-BGP的选路实验
HCIA experiment
京东商品详情API调用实例讲解
buildroot setup dhcp
矩阵分析——微分、积分、极限
CLUSTER DAY04 (Block Storage Use Cases, Distributed File Systems, Object Storage)