Du kan använda GROUP BY
och WITH ROLLUP
, så här:
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
Du kan använda GROUP BY
och WITH ROLLUP
, så här:
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