题解 | #牛客的课程订单分析(七)#
牛客的课程订单分析(七)
https://www.nowcoder.com/practice/d6f4a37f966145da8900ba9edcc4c068
select if (c.name is NULL, 'GroupBuy', c.name) source, count(*) cnt from ( select *, count(*) over ( partition by user_id ) as ocnt from order_info where date > '2025-10-15' and status = 'completed' and product_name in ('C++', 'Java', 'Python') ) o left join client c on o.client_id = c.id where ocnt > 1 group by source order by source;