Aby dodać pola (kolumny):
SELECT col1, col2, col3, (col1+col2+col3) AS Total FROM table;
Aby dodać wiersze razem, użyj SUM()
agregat:
SELECT
userid,
SUM(col1) AS col1_total,
SUM(col2) AS col2_total
FROM table
GROUP BY userid
Aby dodać pola (kolumny):
SELECT col1, col2, col3, (col1+col2+col3) AS Total FROM table;
Aby dodać wiersze razem, użyj SUM()
agregat:
SELECT
userid,
SUM(col1) AS col1_total,
SUM(col2) AS col2_total
FROM table
GROUP BY userid