题解 | #牛客的课程订单分析(三)#
牛客的课程订单分析(三)
http://www.nowcoder.com/practice/4ae8cff2505f4d7cb68fb0ec7cf80c57
SELECT order_info.* FROM order_info
JOIN
(SELECT user_id, COUNT(*) count FROM order_info
WHERE date > '2025-10-15' AND status = 'completed'
AND product_name IN ('C++', 'Python', 'Java')
GROUP BY user_id) t
ON order_info.user_id = t.user_id
WHERE t.count >= 2
AND date > '2025-10-15' AND status = 'completed'
AND product_name IN ('C++', 'Python', 'Java')
ORDER BY id;