2021-03-17
閱讀量:
471
mysql怎么求工作日和周末PV、UV、人均瀏覽量、成交量、銷售額
問:
mysql怎么求工作日和周末PV、UV、人均瀏覽量、成交量、銷售額,
示例數據如下:
答:
參考答案:
select
周,
sum(behavior_type='pv') as 瀏覽量,
count(distinct user_id) as 訪客數,
sum(behavior_type='pv')/count(distinct user_id) as 人均瀏覽量,
sum(behavior_type='buy') as 成交量,
sum(if(behavior_type='buy',amount,0)) as 銷售額
from userbehavior_new
group by 周;






評論(0)


暫無數據
推薦帖子
0條評論
0條評論
0條評論