题解 | 牛客的课程订单分析(六)
牛客的课程订单分析(六)
https://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f
select oi.id, is_group_buy, if(is_group_buy = 'NO',name, 'None') as client_name from order_info oi left join client c on oi.client_id = c.id where date > '2025-10-15' and status = 'completed' and product_name in ('C++', 'Java', 'Python') and user_id in ( select user_id from order_info where date > '2025-10-15' and status = 'completed' and product_name in ('C++', 'Java', 'Python') group by user_id having count(id) > 1 ) order by id asc
第一次写文字表述,如有不对请各位大佬见谅:这里要注意,order_info表中的client_id才是和client表中的id匹配的,不是order_info.id = client.id 而是 order_info.client_id = client.id。