Do you mean like this?

SELECT    SUM(value)
FROM      myTable

If you have multiple columns to return, simply add each non-aggregate (i.e., summed) row to the GROUP BY clause:

SELECT    firstName, lastName, SUM(value)
FROM      myTable
GROUP BY  firstName, lastName
Answer from Devin Burke on Stack Overflow
๐ŸŒ
w3resource
w3resource.com โ€บ mysql โ€บ aggregate-functions-and-grouping โ€บ aggregate-functions-and-grouping-sum().php
MySQL SUM() function
March 2, 2026 - The outer query then calculates the sum of the alias 'mysum', effectively giving the total count of rows where 'no_page' is greater than 200 across all rows in the 'book_mast' table. The alias 'bb' is used to reference the result of the subquery within the outer query. The query will return a single value, which is the sum of the count of rows where 'no_page' is greater than 200 in the 'book_mast' table. This provides insights into the total number of books with more than 200 pages in the dataset. ... mysql> SELECT SUM(mysum) -> FROM( -> SELECT COUNT(*) AS mysum -> FROM book_mast -> WHERE no_page>200) AS bb; +------------+ | SUM(mysum) | +------------+ | 12 | +------------+ 1 row in set (0.02 sec)
๐ŸŒ
Javatpoint
javatpoint.com โ€บ mysql-sum
MySQL sum() - javatpoint
It allows us to count all rows or only some rows of the table that matches a specified condition. It is a type of aggregate function whose return type is BIGINT. This function... ... MySQL's aggregate function is used to perform calculations on multiple values and return the result in a single value like the average of all values, the sum of all values, and maximum & minimum value among certain groups of values.
๐ŸŒ
Learning About Electronics
learningaboutelectronics.com โ€บ Articles โ€บ How-to-get-the-sum-of-all-rows-of-a-MySQL-table-column-using-PHP.php
How to Get the Sum of All Rows of a column of a MySQL Table Using PHP
So the above code adds up all the rows of the orders column. Doing the math, adding up all the orders, we get 27.50 (5.50 + 7.00 + 9.00 + 2.25 + 3.75= 27.50). So to explain the code a little, we first connect to the database. Then we query the database using the $result variable. This $result variable queries the database by getting the SUM of the orders column AS totalsum from the CustomerOrders table.
๐ŸŒ
DataCamp
datacamp.com โ€บ doc โ€บ mysql โ€บ mysql-sum
MySQL SUM() Function: Usage & Examples
The `SUM()` function in MySQL is used to calculate the total sum of a numeric column. It is particularly useful for aggregating data across rows in queries like sales totals, amounts, or any numerical data. The `SUM()` function is commonly used in `SELECT` statements combined with `GROUP BY` ...
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ mysql sum
MySQL SUM() Function - Scaler Topics
May 18, 2023 - Once all rows have been iterated over, the total sum is returned. We can also use the SUM() function with the GROUP BY and HAVING clauses in MySQL to perform aggregate addition of specific columns based on certain conditions.
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ func_mysql_sum.asp
MySQL SUM() Function
The SUM() function calculates the sum of a set of values.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ mysql โ€บ mysql_aggregate_functions_sum.htm
MySQL - SUM() Function
The MySQL SUM() function is an aggregate function that is used to calculate the sum of all values in a particular column/field. If the specified row(s) doesn't exist this function returns NULL.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ get-the-sum-of-a-column-in-all-mysql-rows
Get the sum of a column in all MySQL rows?
Use aggregate function SUM() to get the sum of a column in al rows. Let us first create a table โˆ’ ยท mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Amount int ); Query OK, 0 rows affected (0.20 sec)
Find elsewhere
๐ŸŒ
MySQL Tutorial
mysqltutorial.org โ€บ home โ€บ mysql aggregate functions โ€บ mysql sum() function
MySQL SUM Function
November 10, 2023 - Summary: in this tutorial, you will learn how to use the MySQL SUM() function to calculate the sum of values in a set. The SUM() function is an aggregate function that allows you to calculate the sum of values in a set.
๐ŸŒ
EDUCBA
educba.com โ€บ home โ€บ data science โ€บ data science tutorials โ€บ mysql tutorial โ€บ mysql sum()
MySQL sum() | Complete Guide to MySQL sum() with Query Examples
June 6, 2023 - The result is zero because there is no row with supplier id 15 in the table Suppliers. We will take two tables, Products and Suppliers, which: ... SELECT SUM(Unit * CostEach) Product_cost FROM Suppliers INNER JOIN Products ON Supplier_ID WHERE Product_Name = 'Maggie'; ... The result sum value evaluates based on a condition provided by the values in the next table. The MySQL SUM() is similar to a mathematical sum calculation that finds the totality of provided table values in the database.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
๐ŸŒ
Plus2Net
plus2net.com โ€บ sql_tutorial โ€บ sql_sum-multiple.php
Sum sql for data in multiple columns and across rows with Total & Percentage
February 5, 2000 - SELECT id, name, class, social, math, science, SUM(social + math + science) AS Total FROM student_sum GROUP BY id UNION SELECT '', '', 'Total', SUM(social), SUM(math), SUM(science), SUM(social) + SUM(math) + SUM(science) FROM student_sum Output ( watch the last row ) We can display grade of the student by using CASE statement in our Query. MySQL Case query executes the statement based on the matching condition. Here we will check total mark against set marks for different levels of grade and allot Grade accordingly.
๐ŸŒ
Answerspoint
answerspoint.com โ€บ questions โ€บ 9 โ€บ how-to-find-sum-of-all-row-in-mysql-query-mysql-count-the-sum-of-all-rows-
How to find sum of all row in mysql query , mysql count the sum of all rows , MySQL - sum column value(s) based on row from the same table
If you have multiple columns to return, simply add each non-aggregate (i.e., summed) row to the GROUP BY clause: SELECT firstName, lastName, SUM(value) FROM myTable GROUP BY firstName, lastName ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ mysql โ€บ sum-function-in-mysql
SUM() Function in MySQL - GeeksforGeeks
July 23, 2025 - Explanation: The SUM(quantity) function calculates the total sum of the quantity column across all rows in the sales table, which is 27 (10 + 5 + 7 + 3 + 2).
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-compute-the-sum-of-all-rows-of-a-column-of-a-mysql-table-using-python
How to Compute the Sum of All Rows of a Column of a MySQL Table Using Python? - GeeksforGeeks
November 26, 2020 - Below is the python script to get row sum of members from the table club: ... # import required module import mysql.connector # connect python with mysql with your hostname, # database, user and password db = mysql.connector.connect(host='localhost', database='gfg', user='root', password='') # create cursor object cursor = db.cursor() # get the sum of rows of a column cursor.execute("SELECT SUM(members) FROM club") # fetch sum and display it print(cursor.fetchall()[0][0]) # terminate connection db.close()
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ sum-values-of-a-single-row-in-mysql
Sum values of a single row in MySQL?
You can use below syntax to sum values of a single row โˆ’ Case 1 โˆ’ The following is the syntax if your column does not have NULL value โˆ’ SELECT yourColumnName1+yourColumnNa