SELECT customer_id

SELECT customer_id, SUM(order_amount) as total_orders, MAX(order_date) as latest_order_date
FROM orders
WHERE order_date < DATE_SUB(NOW(), INTERVAL 30 DAY)
GROUP BY customer_id
HAVING total_orders > 1000;

posted @ 2023-12-01 08:57  丶漏电姐姐  阅读(29)  评论(0编辑  收藏  举报