The Most Recent Three Orders
teaching version: for each customer, keep the three newest orders with a window ranking, then sort the result by name and date. Ties on a date break by the larger order id. Sample tables are invented.
teaching version: for each customer, keep the three newest orders with a window ranking, then sort the result by name and date. Ties on a date break by the larger order id. Sample tables are invented.