题解 | #牛客的课程订单分析(二)#gary
牛客的课程订单分析(二)
http://www.nowcoder.com/practice/4ca4137cb490420cad06d2147ae67456
select user_id
from order_info
where datediff(date,"2025-10-15")>0
and status = "completed"
and product_name in("C++","Java","Python")
group by user_id
having count(id)>=2
order by user_id
select oi1.user_id
from order_info oi1
left join (
select oi2.user_id , count(user_id) cnt
from order_info oi2
group by oi2.user_id
) x using (user_id)
where datediff(date,"2025-10-15")>0
and status ="completed"
and product_name in("C++","Java","Python")
and x.cnt >= 2
group by oi1.user_id