题解 | 牛客的课程订单分析(六)
牛客的课程订单分析(六)
https://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f
select id,is_group_buy,client_name from
(select oi.id,oi.is_group_buy,
case oi.is_group_buy when 'No' then c.name
when 'Yes' then null end client_name,
count(*)over(partition by oi.user_id) ct
from order_info oi left join client c on oi.client_id = c.id
where oi.date>'2025-10-15' and oi.status='completed' and oi.product_name in ('C++','Python','Java')) e
where e.ct >1
order by id
此题也可用常规group,不过要注意子句和主句都要加上限制条件
查看9道真题和解析