题解 | 查询下订单用户访问次数?
select user_id, count(user_id) as visit_nums from (select t1.user_id, date(t1.visit_time) as visit_time,date(t1.leave_time) as leave_time from visit_tb as t1 inner join (select distinct user_id from order_tb where date(order_time)="2022-09-02") as t2 on t1.user_id=t2.user_id ) as t3 where visit_time="2022-09-02" and leave_time="2022-09-02" group by user_id order by visit_nums desc