题解 | 牛客的课程订单分析(七)
牛客的课程订单分析(七)
https://www.nowcoder.com/practice/d6f4a37f966145da8900ba9edcc4c068
select if(t1.name is null,"GroupBuy",t1.name) scorce,count(*) cnt from (select client.name,count(*)over(partition by user_id) cnt1 from order_info oi left join client on oi.client_id = client.id where product_name in ("C++","Java","Python") and status = "completed" and date > "2025-10-15") as t1 where cnt1 >= 2 group by t1.name order by scorce
表连接+子查询+if函数
先查询出符合条件的表,其中加上一列id数,再在外层筛选出>=2