with temp as (select date(visit_time) as date_visit,count(distinct user_id) as visit_count from visit_tb group by date(visit_time) ), temp2 as ( select date(order_time) as date_order,count(distinct user_id) as order_count from order_tb group by date(order_time) ) select t1.date_visit as date,concat(round(order_count/visit_count*100,1),'%') as cr from temp2 t2 join temp t1 on t1.date_visit=t2.date_order;