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

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

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

with
-- 每天的访问人数(存在一个用户在一天内多次访问的情况,需去重))
    t1 as (
        select
            date(visit_time) v_time,
            count(distinct user_id) v_num
        from
            visit_tb
        group by
            v_time
    ),
-- 每天的下单人数(存在一个用户在一天内多次下单的情况,需去重)
    t2 as (
        select
            date(order_time) o_time,
            count(distinct user_id) o_num
        from
            order_tb
        group by
            o_time
    )
select
    o_time date,
    concat(round((o_num / v_num) * 100, 1), '%') cr
from
    t1
    join t2 on t1.v_time = t2.o_time
order by
    date

全部评论

相关推荐

秒拒也太伤人心了
码农索隆:非得字节嘛
投递字节跳动等公司8个岗位
点赞 评论 收藏
分享
Twilight_m...:还是不够贴近现实,中关村那块60平房子200万怎么可能拿的下来,交个首付还差不多
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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