题解 | #牛客的课程订单分析(六)#

牛客的课程订单分析(六)

https://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f

select
    t1.id,
    t1.is_group_buy,
    client.name as client_name
from
    client right join
    (
        select
            *,
            count(id) over (
                partition by
                    user_id
            ) cnt
        from
            order_info
        where
            datediff (date, "2025-10-15") > 0
            and status = 'completed'
            and product_name in ('C++', 'Python', 'Java')
    ) t1
     on t1.client_id = client.id  ---连接键要注意,是client_id不是id
where
    t1.cnt >= 2
order by
    t1.id asc

全部评论

相关推荐

08-11 16:33
门头沟学院 Java
码农索隆:很好,你很棒,但是.... 我举报了!!!
字节跳动开奖374人在聊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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