COUNT
SUM
AVG
合計を返します。
SUM(expr)
下記の値を入力するとサンプルに即時反映されます。
customer_id
total_amount
total_spent
orders
-- 고객별 누적 주문 금액 SELECT customer_id, SUM(total_amount) AS total_spent FROM orders GROUP BY customer_id ORDER BY total_spent DESC;