CDA持证人阿涛哥

2022-12-30   阅读量: 373

Mysql

mysql 学习49--浏览—收藏---加购—购买的转化率

扫码加入数据分析学习群

-- 3.2.2 浏览—收藏-加购—购买的转化率

select

behavior_type,

count(distinct user_id) as 用户数,

lag(count(distinct user_id),1) over(order by if(behavior_type='pv',1,if(behavior_type='fav',2,if(behavior_type='cart',3,4)))) as 上一行为用户数,

ifnull(count(distinct user_id)/lag(count(distinct user_id),1) over(order by if(behavior_type='pv',1,if(behavior_type='fav',2,if(behavior_type='cart',3,4)))),1) as 转化率

from UserBehavior_new

where behavior_type in ('pv','fav','cart','buy')

group by behavior_type;

##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
0.0000 1 0 关注作者 收藏

评论(0)


暂无数据

推荐课程