- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Finding the sum of integers from multiple MySQL rows in same column?
Let us first create a table −
mysql> create table DemoTable739 (Price int); Query OK, 0 rows affected (0.65 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable739 values(100); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable739 values(50); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable739 values(1200); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable739 values(500); Query OK, 1 row affected (0.37 sec) mysql> insert into DemoTable739 values(800); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable739;
This will produce the following output -
+-------+ | Price | +-------+ | 100 | | 50 | | 1200 | | 500 | | 800 | +-------+ 5 rows in set (0.00 sec)
Following is the query to find the sum of integers from multiple MySQL rows in same column −
mysql> select sum(Price) as Total_Price from DemoTable739;
This will produce the following output -
+-------------+ | Total_Price | +-------------+ | 2650 | +-------------+ 1 row in set (0.00 sec)
- Related Articles
- Finding total number of rows of tables across multiple databases in MySQL?
- MySQL - SUM rows with same ID?
- Get the sum of a column in all MySQL rows?
- Update multiple rows in a single column in MySQL?
- Count(*) rows from multiple tables in MySQL?
- How to return rows that have the same column values in MySQL?
- Find rows that have the same value on a column in MySQL?
- Concatenate data from multiple rows using GROUP_CONCAT() in MySQL?
- How to find the sum of rows of a column based on multiple columns in R data frame?
- How to find the sum of rows of a column based on multiple columns in R’s data.table object?
- Inserting multiple rows in MySQL?
- Adding integers from a variable to a MySQL column?
- MySQL query to sum the Product Price values from similar columns for same customers and display the result in the same column
- Finding Duplicate Rows in MySQL (Composite Key)?
- MySQL query to find sum of fields with same column value?

Advertisements