题解 | 统计用户从访问到下单的转化率
select
o.date as date,
concat (round(o.c / v.c * 100, 1), '%') as cr
from
visit_tb v,
(
select
date_format (order_time, '%Y-%m-%d') as date,
count(distinct user_id) as c
from
order_tb
group by
date_format (order_time, '%Y-%m-%d')
) o,
(
select
date_format (visit_time, '%Y-%m-%d') as date,
count(distinct user_id) as c
from
visit_tb
group by
date_format (visit_time, '%Y-%m-%d')
) v
where
o.date = v.date
group by
o.date
order by
date

