2022-12-30
閱讀量:
992
mysql 學習49--瀏覽—收藏---加購—購買的轉化率
-- 3.2.2 瀏覽—收藏-加購—購買的轉化率
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 轉化率
from UserBehavior_new
where behavior_type in ('pv','fav','cart','buy')
group by behavior_type;
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
1條評論
0條評論