Du kan blot sætte formlen (udtrykket) inde i SUM
:
SELECT payment_id, SUM(`unit cost` * quantity) AS total
FROM myTable
GROUP BY payment_id
Du kan blot sætte formlen (udtrykket) inde i SUM
:
SELECT payment_id, SUM(`unit cost` * quantity) AS total
FROM myTable
GROUP BY payment_id