SELECT category_id, SUM(price) as totalprice
FROM products
GROUP BY category_id WITH ROLLUP
Consulte la página en el manual
SELECT category_id, SUM(price) as totalprice
FROM products
GROUP BY category_id WITH ROLLUP
Consulte la página en el manual