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

select o.date,concat(round(o.a/v.b*100,1),'%') cr
from (
    select date(visit_time) date,count(distinct user_id) b
    from visit_tb 
    group by date(visit_time)
) v
join (
    select date(order_time) date,count(distinct user_id) a
    from order_tb
    group by date(order_time)
) o on v.date=o.date
group by o.date
order by o.date

没想到最后是用两个子查询join做出来的

另:先四舍五入再乘100和先*100后四舍五入结果不同

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务