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

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

https://www.nowcoder.com/practice/9958aed1e74a49b795dfe2cb9d54ee12

with
t1 as(
    select
        user_id,
        date_format(order_time,'%Y-%m-%d') as order_date,
        count(user_id) as cnt
    from
        order_tb
    group by
        order_date,
        user_id
)
,t2 as(
    select
        order_date,
        user_id,
        cnt as order_nums,
        vip
    from
        t1 left join uservip_tb using(user_id)
    where
        cnt>=2
    order by
        order_date,
        order_nums
)

select * from t2

全部评论

相关推荐

点赞 评论 收藏
分享
11-27 16:41
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务