On my previous post, we used the SUM function to calculate the TotalSales in a store. What if we want to display the TotalSales by PRODUCT? Below is the SALES table that we will used in our query.
![]()  | 
| SALES | 
Query
SELECT product,SUM(total) FROM sales group by product
Output
First, the query will group all the same products and calculate the sum of the total column.


0 comments:
Post a Comment