题目链接:点击打开链接
题目大意:略。
解题思路:略。
AC 代码
WITH t AS(SELECT *, ROW_NUMBER() OVER(PARTITION BY customer_id ORDER BY order_date DESC) rw FROM Orders) SELECT name customer_name, t.customer_id, order_id, order_date FROM t JOIN Customers c USING(customer_id) WHERE rw < 4 ORDER BY customer_name, t.customer_id, order_date DESC