题解 | 统计用户从访问到下单的转化率
SELECT DATE(visit_time) AS date, CONCAT(ROUND(COUNT(DISTINCT o.user_id)/COUNT(DISTINCT v.user_id)*100, 1),'%') AS cr FROM visit_tb v LEFT JOIN order_tb o ON v.user_id = o.user_id AND DATE(v.visit_time) = DATE(o.order_time) GROUP BY date ORDER BY date