
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In MySQL, how we can get the total value by category in one output row?
With the help of the MySQL SUM() function, we can get the total value by category in one output row. For example in table ‘ratelist’ if we want to get the total value of category ‘price’ then we can use SUM() on price as follows −
mysql> select SUM(price) as totalprice from ratelist; +------------+ | totalprice | +------------+ | 3237 | +------------+ 1 row in set (0.00 sec)
The query above returns the total value of price in one output row.
- Related Questions & Answers
- How can we get the sorted MySQL output?
- How can we get the total number of rows affected by MySQL query?
- Get total in the last row of MySQL result?
- Can we get total number of rows in a MySQL database?
- How can we fetch a particular row as output from a MySQL table?
- How can we get the summary output of a column in MySQL result set itself?
- How can we sort MySQL output in descending order?
- How can we sort MySQL output in ascending order?
- Can we select row by DATEPART() in MySQL? Is it possible?
- How can we get an idea about the server performance from the output of MySQL?
- How can we fetch one or more columns as output from a MySQL table?
- How can we update the values in one MySQL table by using the values of another MySQL table?
- How can we get sorted output based on multiple columns?
- Decrease a row value by 1 in MySQL?
- Can we GROUP BY one column and select all data in MySQL?
Advertisements