题解 | 查询单日多次下订单的用户信息?
-- 单日多次下单的用户 with t as ( select date(ot.order_time) as order_date, ot.user_id as user_id, count(*) over(partition by user_id, date(ot.order_time)) as order_nums, ut.vip as vip from order_tb ot join uservip_tb ut on ot.user_id=ut.user_id order by ot.user_id,ot.order_time ) select distinct order_date, user_id, order_nums, vip from t where order_nums > 1