2022-12-30
閱讀量:
668
mysql 學(xué)習(xí)47--行為轉(zhuǎn)化分析(轉(zhuǎn)化率=當(dāng)前行為用戶數(shù)/上一行為用戶數(shù))
-- 3.2 行為轉(zhuǎn)化分析(轉(zhuǎn)化率=當(dāng)前行為用戶數(shù)/上一行為用戶數(shù))
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
group by behavior_type;






評(píng)論(0)


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