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


with temp as (
    select 
        user_id,
        date(order_time) as order_time,
        count(1) as  order_nums
        from order_tb group by date(order_time) ,user_id having order_nums>=2)

select 
    order_time as order_date,
    a.user_id,
    order_nums,
    vip 
     from temp a left join uservip_tb b
     on a.user_id=b.user_id order by order_nums desc

全部评论

相关推荐

不愿透露姓名的神秘牛友
03-10 14:27
已编辑
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务