select
v.user_id,
count(distinct v.visit_time) as visit_nums
from
visit_tb v left join order_tb o
on
o.user_id=v.user_id and o.order_time like '2022-09-02%' and v.visit_time like '2022-09-02%'
where
o.order_time is not null
and v.visit_time is not null
and v.leave_time is not null
group by
v.user_id
order by
visit_nums desc;
核心隐藏条件:下单日期和访问日期都必须是2022-09-02,刚开始只限定了下单日期没限定访问日期导致报错。



京公网安备 11010502036488号