2022-12-30
閱讀量:
921
mysql 學(xué)習(xí)49--瀏覽—收藏---加購—購買的轉(zhuǎn)化率
-- 3.2.2 瀏覽—收藏-加購—購買的轉(zhuǎn)化率
select
behavior_type,
count(distinct user_id) as 用戶數(shù),
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 上一行為用戶數(shù),
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 轉(zhuǎn)化率
from UserBehavior_new
where behavior_type in ('pv','fav','cart','buy')
group by behavior_type;
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






評論(0)


暫無數(shù)據(jù)
CDA考試動態(tài)
CDA報(bào)考指南
推薦帖子
0條評論
1條評論
0條評論