For example I have a table like this:
product | quantity | something ------------------------------- abc | 5 | 2 xzy | 5 | 2 asd
(SELECT product, quantity, something FROM tablename) UNION (SELECT "all" AS product, SUM(quantity) AS quantity, SUM(something) AS something FROM tablename)
This is working query. It will add a fourth row as desired at the end of your result