Vzorec (výraz) můžete jednoduše vložit do SUM
:
SELECT payment_id, SUM(`unit cost` * quantity) AS total
FROM myTable
GROUP BY payment_id
Vzorec (výraz) můžete jednoduše vložit do SUM
:
SELECT payment_id, SUM(`unit cost` * quantity) AS total
FROM myTable
GROUP BY payment_id