题解 | #牛客的课程订单分析(七)#
牛客的课程订单分析(七)
http://www.nowcoder.com/practice/d6f4a37f966145da8900ba9edcc4c068
SELECT IFNULL(t1.name, "GroupBuy") AS source, COUNT(*) AS cnt FROM ( SELECT *, COUNT(*) OVER(PARTITION by user_id) AS num FROM order_info WHERE date > "2025-10-15" AND status = "completed" AND product_name IN ("C++", "Python", "Java") ) AS t LEFT JOIN client AS t1 ON t.client_id = t1.id WHERE t.num > 1 GROUP BY source ORDER BY source