题解 | #牛客的课程订单分析(七)#
牛客的课程订单分析(七)
http://www.nowcoder.com/practice/d6f4a37f966145da8900ba9edcc4c068
SELECT IF(a.client_id = 0,'GroupBuy',c.name) AS source,COUNT(*) AS cnt FROM (SELECT client_id FROM order_info 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 status = 'completed' GROUP BY user_id HAVING COUNT(*) >= 2 ) ) a LEFT JOIN client c ON a.client_id = c.id GROUP BY a.client_id ORDER BY source
虽然写了很久,但是最终做出来的时候好开心,像个小孩一样,加油
2021年7月15日23:05 于广州番禺科技园