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

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

全部评论

相关推荐

在看牛客的社畜很积极:身高体重那一行信息去掉,学校那一行的信息放上面,找半天都没找到你是哪个学校什么专业的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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