- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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?
152 Lectures 16 hours
87 Lectures 5.5 hours
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.
- 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?