题解 | 查询下订单用户访问次数?
select
v.user_id as user_id,
count(v.info_id) as visit_nums
from
visit_tb v
where
v.user_id in (
select
user_id
from
order_tb
where
date_format (order_time, '%Y-%m-%d') = '2022-09-02'
)
and date_format (v.visit_time, '%Y-%m-%d') = '2022-09-02'
and date_format (v.leave_time, '%Y-%m-%d') = '2022-09-02'
group by
v.user_id
order by
visit_nums desc
腾讯云智研发成长空间 294人发布