Website Scripts And Cloud Tutorials

Find the sum of multiple fields inside a table in mysql

Byadmin

Feb 3, 2011

Last updated on April 8th, 2022 at 01:53 pm

Click to rate this tutorial!
[Total: 10 Average: 3.4]

Very simple query to find out the sum of multiple fields inside a mysql table.
Mysql
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;

Click to rate this tutorial!
[Total: 10 Average: 3.4]

Leave a Reply

Your email address will not be published.