题解 | #牛客的课程订单分析(七)#
牛客的课程订单分析(七)
http://www.nowcoder.com/practice/d6f4a37f966145da8900ba9edcc4c068
select case a.client_id when '0' then 'GroupBuy' else b.name end as source ,count(a.client_id) as cnt from ( select user_id, client_id, count(id) over(partition by user_id) as buy_cnt from order_info where product_name in ('C++', 'Java', 'Python') and date > '2025-10-15' and status = 'completed' ) a left join client b on a.client_id = b.id where a.buy_cnt >= 2 group by source order by source