题解 | 查询单日多次下订单的用户信息?

-- 单日多次下单的用户
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




全部评论

相关推荐

找不到工作死了算了:你已经熟练掌握c语言啦,可以投简历参加秋招了
点赞 评论 收藏
分享
offer小狗:就这样上秋招??
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务