01-24 23:03
太平洋保险_数据资产治理办公室_数据开发工程师 0 点赞 评论 收藏
分享
想不到什么昵称:select a.new_day '新增日期'
,count(a.qq_no) '新增用户数'
,count(case when a.new_day = date_sub(b.read_day, 1) then a.qq_no else null end)/count(a.qq_no) 'd1阅读留存率'
,count(case when a.new_day = date_sub(b.read_day, 3) then a.qq_no else null end)/count(a.qq_no) 'd3阅读留存率'
,count(case when a.new_day = date_sub(b.read_day, 15) then a.qq_no else null end)/count(a.qq_no) 'd15阅读留存率'
,count(case when a.new_day = date_sub(b.read_day, 30) then a.qq_no else null end)/count(a.qq_no) 'd30阅读留存率'
from
(select new_day, qq_no
from t1
where new_day <= '2019-08-10' and new_day >= '2019-08-01'
group by new_day, qq_no
)a
left join
(select read_day, qq_no
from t2
group by read_day, qq_no
)b
on a.qq_no = b.qq_no
group by a.new_day
0 点赞 评论 收藏
分享
关注他的用户也关注了: