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

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

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

select
    distinct 
    user_id,
    min(date) over(partition by user_id order by date) first_buy_date,
    count(*) over(partition by user_id) cnt
from
    (
        select
            *    
        from
            (
                select
                    *,
                    count(*) over(partition by user_id) num
                from 
                    (
                        select
                            *
                        from
                            order_info o 
                        where
                            date > "2025-10-15" and
                            product_name in("C++","Java","Python") and
                            status = "completed"
                    ) t
            ) t
        where
            num >= 2
    ) t
order by
    user_id
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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