数式(式)をSUM内に置くだけです。 : SELECT payment_id, SUM(`unit cost` * quantity) AS total FROM myTable GROUP BY payment_id