Puedes usar GROUP BY
y WITH ROLLUP
, así:
SELECT
id
, SUM(jan) as jan
, SUM(feb) as feb
, SUM(mar) as mar
, SUM(jan+feb+mar) as TRS
FROM test
GROUP BY id WITH ROLLUP
Demostración en vivo en sqlfiddle.
Puedes usar GROUP BY
y WITH ROLLUP
, así:
SELECT
id
, SUM(jan) as jan
, SUM(feb) as feb
, SUM(mar) as mar
, SUM(jan+feb+mar) as TRS
FROM test
GROUP BY id WITH ROLLUP
Demostración en vivo en sqlfiddle.