I have a table in my database with two columns as int for example cal1 and cal2.
I make the sum from each row as in select ( cal1 + cal2) from cat as total, now I want to do the sum from all columns total if is possible.
I have a table in my database with two columns as int for example cal1 and cal2.
I make the sum from each row as in select ( cal1 + cal2) from cat as total, now I want to do the sum from all columns total if is possible.
You can do the addition in the SUM :
SELECT SUM(cal1+cal2) AS total
FROM cat
SELECT (SUM(cal1) + SUM(cal2)) AS TotalSum FROM cat
Thats to sum the values of all rows together. If you want to sum all columns up, you have to specifically write their names into the column list.