Last updated on April 8th, 2022 at 01:53 pm
Very simple query to find out the sum of multiple fields inside a mysql table.
Lets say we have 2 numeric columns , COL1 and COL2 then the mysql query to find the sum of those two field is
Let us assume we have two columns with INT data type named VERSION and AVG_ROW_LENGTH. Then the query to find the sum will look like below
SELECT SUM(VERSION)+SUM(AVG_ROW_LENGTH) FROM TABLES;
Here is the screenshot of the query
You can also try this query to name the column as Output , change it to any name of your choice.
SELECT SUM(VERSION)+SUM(AVG_ROW_LENGTH) as Output FROM TABLES;