![]() ![]() In the above query, we specify the columns we need to display in our query result in SELECT clause. ![]() The above query is very similar to aggregating data using GROUP BY statement, except that you add WITH ROLLUP keyword after GROUP BY clause. You can also use it to add total rows and subtotal rows to your data, instead of calculating them separately and combining the result using UNION statement. MySQL Rollup allows you to easily roll up data and calculate subtotals using a single statement. Here are the steps to calculate total and subtotal using MySQL Rollup. Here’s how to use MySQL Rollup to calculate total and subtotal in MySQL. MySQL Rollup is suitable for such use cases. It can be tedious to aggregate data using UNION statement especially to calculate subtotals. Sometimes you may need to calculate totals and subtotals in MySQL, or add total rows to your data.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |