题解 | 查询下订单用户访问次数?
不明白为什么这么写输出的和答案不一样,答案多了一条user_id=10的数据
select user_id
, count(user_id) visit_nums
from visit_tb
where user_id in
(select user_id from order_tb
where left(trim(order_time),10) = "2022-09-02")
and left(trim(visit_time),10) = "2022-09-02"
and left(trim(leave_time),10) = "2022-09-02"
group by user_id
order by visit_nums desc;