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

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后四舍五入结果不同

全部评论

相关推荐

05-01 22:41
中南大学 Java
点赞 评论 收藏
分享
04-18 15:58
已编辑
门头沟学院 设计
kaoyu:这一看就不是计算机的,怎么还有个排斥洗碗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务