题解 | 统计用户从访问到下单的转化率

统计用户从访问到下单的转化率

https://www.nowcoder.com/practice/eaff8684aed74e208300f2737edbb083

-- 计算每天访问的人
with t1 as (
    select 
        date(visit_time) as v_time,
        count(distinct user_id) as v_num
        from visit_tb
        group by v_time
),
-- 计算每天下单的人
t2 as (
    select
        date(order_time) as o_time,
        count(distinct user_id) as o_num
        from order_tb
        group by o_time
)
-- 整合
select 
    o_time as date,
    concat(round((o_num/v_num) * 100 , 1),'%') cr 
    from t1
    join t2 on t1.v_time = t2.o_time
    order by date
    

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务